$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.= "$req\n";
> deo> $header.= "\r\n";
>
>
>
>
> deo> $fp = fsockopen("host", "80", $errno, $errstr, $timeout = 30);
> 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php