Re: fsock sending bad request
| From: | Curt Zirzow | Date: | Thu, 23 Oct 2003 14:41:21 +0000 |
| Subject: | Re: fsock sending bad request | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167287@lists.php.net to get a copy of this message | ||
* Thus wrote daniel@electroteque.org (daniel@electroteque.org):
> Hi there the following code doesnt seem to work, i am getting a bad request
> sent back from the server, what could be the problem of something so
> simple ?
>
> $header .= "POST test.php HTTP/1.0\r\n";
> $header.= "Host: host\r\n";
> $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
> $header .= 'Content-Length: ' . strlen($req) . "\n\n";
> $header .= "Connection: close\n\n";
> $header.= "$req\n";
> $header.= "\r\n";
The last two lines should be:
$header.= "\r\n";
$header.= "$req"; #Note, no \n
Make sure all your headers have \r\n endings. Technically the $req
is not part of the headers but the actual content to be sent.
Curt
--
"My PHP key is worn out"
PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/