Jump to content

HTTP-sent POST data does not arrive to remote script


kizokumaru

Recommended Posts

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.