kizokumaru Posted November 21, 2006 Share Posted November 21, 2006 I've got some trouble when trying to send a HTTP POST variable to a remote script. I've got this piece of code:fwrite($this->sock, "POST /" . $this->dest . " HTTP/1.0" . RC);fwrite($this->sock, "Host: " . $this->IP . RC);fwrite($this->sock, "Content-type: application/x-www-form-urlencoded" . RC);fwrite($this->sock, "Authorization: Basic ".base64_encode(USUARIO_AUTHORIZED . ":" . PASSWORD_AUTHORIZED) . RC); fwrite($this->sock, "Content-length: " . strlen($datos) . RC);fwrite($this->sock, "Accept: /*" . RC);fwrite($this->sock, RC);fwrite($this->sock, "$datos" . RC);fwrite($this->sock, RC);$this->sock contains a valid sock, RC is a constant containing "\r\n", $this->dest contains the destination PHP script, and $datos = "validation=" . $key;The fact is that the remote script returns nothing when trying to access $HTTP_POST_VARS['validation'], for example, which makes me think that POST data is not arriving to its destination.After a few freads and concatenations the remote script returns this:HTTP/1.1 200 OK Date: Tue, 21 Nov 2006 18:10:31 GMT Server: Apache/2.0.55 (Win32) PHP/5.1.6 X-Powered-By: PHP/5.1.6 Content-Length: 0 Connection: close Content-Type: text/html Any idea about solving this trouble, or any better method to send the POST data?Thanks! Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted November 22, 2006 Share Posted November 22, 2006 I would recommend looking at this page. It is much easier to post and retrieve data this way than the way you are doing it.http://us3.php.net/manual/en/wrappers.http.php#AEN271674 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.