Bonsoir,
afin de récupérer des informations sur le charset des sites j'utilise la bibilothèque http.
Mon code est simplissime, trop peut-être :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<?php
define('EOL', "\r\n");
echo http_head('http://lefigaro.fr').EOL;
echo http_head('http://lemonde.fr').EOL;
echo http_head('http://lequipe.fr').EOL;
echo http_head('http://www.developpez.net/forums/').EOL;
?>
qui me renvoit
HTTP/1.1 301 Moved Permanently
Date: Sat, 07 Apr 2007 21:17:06 GMT
Server: Apache/1.3.37 (Unix) PHP/5.1.5
Location: http://www.lefigaro.fr/graal/exploit/001.php
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 302 Found
Date: Sat, 07 Apr 2007 21:17:13 GMT
Server: Apache
Location: http://www.lemonde.fr/graal/exploit/001.php
Connection: close
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 404 Not Found
Date: Sat, 07 Apr 2007 21:17:13 GMT
Server: Apache
Content-Type: text/html

HTTP/1.1 200 OK
Date: Sat, 07 Apr 2007 21:17:05 GMT
Server: Apache/2.2.4 (Unix) PHP/5.2.1
X-Powered-By: PHP/5.2.1
Set-Cookie: bbsessionhash=d6f6e0bbd4574814fb4a41441b84bd3d; path=/
Set-Cookie: bblastvisit=1175980625; expires=Sun, 06-Apr-2008 21:17:05 GMT; path=/
Set-Cookie: bblastactivity=0; expires=Sun, 06-Apr-2008 21:17:05 GMT; path=/
Cache-Control: private
Pragma: private
Content-Type: text/html; charset=ISO-8859-1
Bien pour les sites 1,2,4 mais pas pour le site 3 de l'équipe.
Pourtant, a priori, un charset utf-8 est bien indiqué (via les "informations sur la page de FF 2.0.0.3)
Et cerise sur le gateau, un code retour 404 alors que le site existe bien !
Faut-il utiliser d'autres méthodes pour récupérer à coup sur les informations sur les headers ?