2
Liste des user-agent cordes
Quelques rapides notes sur user-agent cordes.
A user-agent string est une chaîne de caractères envoyée à chaque requête HTTP du client au serveur d'applications. Une chaîne comprend des informations utiles sur le type et la version du navigateur, système d'exploitation, de la langue. Le user-agent est une forme d'identification d'un client HTTP, encore cette identification - peut être modifié et modifié de façon à fournir des informations (par exemple par le biais add-on de Firefox ou vous-même).
Il existe de nombreux sites qui offrent des listes de user-agent des chaînes, certaines de ces facilement accessibles et mises à jour sont les suivants:
http://www.useragentstring.com/
http://www.useragents.org/
Plus d'informations sur user-agent ici.
Notre simple à utiliser avec PHP / CURL (extrait):
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => selectUseragent(), // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
);
$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
function selectUseragent() {
$input=array('Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)',
'Opera/9.52 (X11; Linux i686; U; fr)',
'Opera/9.52 (X11; Linux i686; U; en)',
'Opera/9.52 (Windows NT 6.0; U; en)',
'Mozilla/5.0 (X11; U; Linux x86_64; it; rv:1.9.0.1) Gecko/2008071717 Firefox/3.0.1',
'Mozilla/5.0 (X11; U; Linux x86_64; fr; rv:1.9.0.1) Gecko/2008071222 Firefox/3.0.1',
'Mozilla/5.0 (X11; U; Linux x86_64; es-ES; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1',
'Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.0.1) Gecko/2008070400 SUSE/3.0.1-0.1',
'Mozilla/5.0 (X11; U; Linux x86_64; pt-BR; rv:1.9b5) Gecko/2008041515 Firefox/3.0b5',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT) AppleWebKit/525 (KHTML, like Gecko) Version/3.1.2 Safari/525.21',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.1.2 Safari/525.21',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)',
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; es-AR; rv:1.7.5) Gecko/20041108 Firefox/1.0',
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; DFO-MPO Internet Explorer 6.0)',
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0',
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.0.4-1.3.1 Firefox/1.0.4',
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.6 (KHTML, like Gecko) Safari/125.12');
return $input[array_rand($input)];
}
RSS des commentaires pour cet article. TrackBack URI







