Bonjour à tous.
Je voudrais écrire un fichier qui collecte automatiquement des données. Il ne fonctionne pas.
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <? header('Content-type: text/html; charset=utf-8'); $horodatage=date(mktime()); $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); $methode = $_SERVER["REQUEST_METHOD"]; $adresse = $_SERVER["REQUEST_URI"]; $referer = $_SERVER["HTTP_USER_AGENT"]; $inF = fopen("http://example.com/dossier/page.ini", "a+" ); fputs($inF, $horodatage." : ".$hostname.",".$methode.",".$adresse."\n"); fclose($inF); }
Cela affiche à l’écran :
La manipulation de fichiers est nouvelle pour moi. J’ai beaucoup cherché, mais je ne comprends pas ce qui produit l’erreur et comment la corriger.Warning: fopen(http://example.com/dossier/page.ini) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /URL du source on line 9
Warning: fputs() expects parameter 1 to be resource, boolean given in /URL du source on line 10
Warning: fclose() expects parameter 1 to be resource, boolean given in /URL du source on line 11
Merci pour vos explications.
Partager