problems with http post
| From: | Ulrik NIelsen | Date: | Wed, 21 May 2003 14:57:34 +0000 |
| Subject: | problems with http post | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-148421@lists.php.net to get a copy of this message | ||
Hi NG,
I have a problem, that I can not understand:
I'm trying to do a post via php's socket functions:
I have two methods A and B. A works but B does not...
A)
fputs($sock, "POST " .$path." HTTP/1.0\r\n");
fputs($sock, "Host: ".$host."\r\n");
fputs($sock, "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030425\r\n");
fputs($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($sock, "Content-length: ".strlen($data)."\r\n");
fputs($sock, "\r\n");
fputs($sock, $data."\r\n");
fputs($sock, "\r\n");
fputs($sock, "\r\n");
B)
$toPost ="POST: ".$path." HTTP/1.0\r\n";
$toPost.="Host: ".$host."\r\n";
$toPost.="User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030425\r\n";
$toPost.="Content-type: application/x-www-form-urlencoded\r\n";
$toPost.="Content-length: ".strlen($data)."\r\n";
$toPost.="\r\n";
$toPost.=$data."\r\n";
$toPost.="\r\n";
$toPost.="\r\n";
fputs($sock,$toPost);
If I dump the $_REQUEST variable on the remote host, I only get the posted values If I'm using method A...
Does any of you have an Idear why ?
--
>> ulrik - ulrik(@)lazy.dk
excuse of the day : Your mail is being routed through Germany ... and
: they're censoring us.
from bofh : http://www.cs.wisc.edu/~ballard/bofh/