deo> $header.= "$req\n";
Tom is right but as usual IIS is wrong and expects it :-( so better to use it anyway.
deo> $fp = fsockopen("host", "80", $errno, $errstr, $timeout = 30);
errno and errstr will not be set unless you pass it by reference.
deo> $header.= "Host: host\r\n"; Host header is usually used only with HTTP/1.1
all the best
[EMAIL PROTECTED] wrote:
$req = "&field=1";
its the data i need to post
Hi,
Thursday, October 23, 2003, 7:58:19 AM, you wrote: deo> Hi there the following code doesnt seem to work, i am getting a bad request deo> sent back from the server, what could be the problem of something so deo> simple ?
deo> $header .= "POST test.php HTTP/1.0\r\n"; deo> $header.= "Host: host\r\n"; deo> $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; deo> $header .= 'Content-Length: ' . strlen($req) . "\n\n"; deo> $header .= "Connection: close\n\n";
deo> $header.= "\r\n";
deo> if (!$fp) { deo> // ERROR deo> echo "$errstr ($errno)"; deo> } else {
deo> //put the data.. deo> fputs ($fp, $header . $req); deo> while (!feof($fp)) { deo> //read the data returned... deo> $res = fgets ($fp, 1024); deo> echo $res; deo> } deo> fclose ($fp); deo> }
you probably don't need this in the header
$header.= "$req\n";
but I have no idea what $req contains
--
regards,
Tom
-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php