You need to open a socket:
http://uk.php.net/manual/en/function.fsockopen.php

Think there's a demo in the comments lower down the page.

Yup, here it is:

 function httpPost($host, $path, $referer, $data) {
     $fp = fsockopen($host, 80);
   fputs($fp, "POST ".$path." HTTP/1.0\r\n");
   fputs($fp, "Host: ".$host."\r\n");
   fputs($fh, "Referer: ".$referer."\r\n");
   fputs($fp, "Content-type: application/x-www-url-encoded\r\n");
   fputs($fp, "Content-length: ".strlen($data)."\r\n");
   fputs($fp, "\r\n");
   fputs($fp, $data."\r\n");
   fputs($fp, "\r\n");

   $tmp_headers = "";
     while ($str = trim(fgets($fp, 4096)))
       $tmp_headers .= $str."\n";

   $tmp_body = "";
   while (!feof($fp))
         $tmp_body .= fgets($fp, 4096);

   fclose($fp);
   return $tmp_body;
 }






"Vincent Dupont" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi all,

I would like to simulate sending a form in POST to a specified URL through
PHP. I knwo how to do this from a HTML form :
<form method="post" action="http://url.com/query";>
blablabla
</form>

I would just like to simulate this because I have some processes that will
change the values of the form before sending it to the 'action' URL


With a GET, the fields would be included into the query strinbg, so this is
quite easy. What happens in a POST?

Any idea is welcome

Vincent
mailto: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to