Re: http request using fsockopen
Rob spilled the following:
>
> I manually create a HTTP request to page C and use the fsockopen method to
> sent the request.
>
> As a result I get the requested page C (status code "200 OK" is returned)
> but the
> POST data is not received/parsed(?). I mean the $_POST array is empty in
> page C. All other PHP scripts in page C is executed as expected though.
>
<snip>
> // headers
> $out ="POST {$path}page_c.php HTTP/1.1 \r\n";
> $out.="Host: $host \r\n";
> $out.="Content-length: ".strlen($query)." \r\n";
> $out.="Content-type: text/html \r\n";
I think you might want to add a:
Content-type: application/x-www-form-urlencoded
here. Also you should urlencode the RHS of the post variables.
> $out.="Connection: Close \r\n\r\n";
Eh? I don't use this myself and it works for me.
HTH
C.
|