fsockopen + fputs

From: Date: Thu, 15 May 2008 23:04:00 +0000
Subject: fsockopen + fputs
Groups: php.general 
Request: Send a blank email to php-general+get-274398@lists.php.net to get a copy of this message
Hello, I use fsockopen and fputs to call a distant URL, but I have the following error : The requested URL /registration/test was not found on this server. This is my code: $req = 'username=' . $usr . '&password=' . $pass . '&date_of_birth=' . $year . "-" . $month . "-" . $day . '&email=' . $email . '&country=' . $country; $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { $header = "POST /registration/test HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; fputs ($fp, $header . $req); while (!feof($fp)) { echo fgets($fp, 1024); } fclose($fp); } However the path www.example.com/registration/test exists so why does it says it cannot find the requested url ? Any idea ? Thank you for any help !! -- View this message in context: http://www.nabble.com/fsockopen-%2B-fputs-tp17264395p17264395.html Sent from the PHP - General mailing list archive at Nabble.com.

« previous php.general (#274398) next »