note 100965 added to function.fsockopen

From: Date: Wed, 17 Nov 2010 18:28:49 +0000
Subject: note 100965 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-174129@lists.php.net to get a copy of this message
Does anybody know why the function fsockopen causes this: Warning: fsockopen() [function.fsockopen]: unable to connect to http://vyznam-jmen.wz.cz/vyhledavani.php:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) ..I've used adjusted code from this discusion: $host = 'vyznam-jmen.wz.cz/vyhledavani.php'; $service_uri = '/cgi-bin/processACT'; $vars = "action=send_datum&obdobi_do=17.11.&obdobi_od=17.11."; # compose HTTP request header $header = "Host: $host "; $header .= "User-Agent: PHP Script "; $header .= "Content-Type: application/x-www-form-urlencoded "; $header .= "Content-Length: ".strlen($vars)." "; $header .= "Connection: close "; $fp = fsockopen("http://".$host, 80, $errno, $errstr); // fopen("http://".$host, "r+"); if (!$fp) { echo "$errstr ($errno)<br/> "; echo $fp; } else { fputs($fp, "POST $service_uri HTTP/1.1 "); fputs($fp, $header.$vars); fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } ---- Server IP: 147.32.160.17 Probable Submitter: 82.209.41.26 ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- https://master.php.net/note/edit/100965 Del: integrated -- https://master.php.net/note/delete/100965/integrated Del: useless -- https://master.php.net/note/delete/100965/useless Del: bad code -- https://master.php.net/note/delete/100965/bad+code Del: spam -- https://master.php.net/note/delete/100965/spam Del: non-english -- https://master.php.net/note/delete/100965/non-english Del: in docs -- https://master.php.net/note/delete/100965/in+docs Del: other reasons-- https://master.php.net/note/delete/100965 Reject -- https://master.php.net/note/reject/100965 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174129) next »