--- Patrick <[EMAIL PROTECTED]> wrote:
> i want my page to send a report to a url, like a
> form. Is that possible thru php?

Sure. For the GET method, you can just use something like
fopen() to open the URL. For the POST method, you can try
something like this:

<base href="http://www.php.net/";>

<?
$content = php_post("www.php.net", "/search.php",
"lang=en_US&pattern=curl&show=manual");
echo $content;

function php_post($host, $path, $data)
{
   $http_response="";

   $fp=fsockopen($host, 80);
   fputs($fp, "POST $path HTTP/1.1\r\n");
   fputs($fp, "Host: $host\r\n");
   fputs($fp, "Content-Type:
      application/x-www-form-urlencoded\r\n");
   fputs($fp, "Content-Length: " .
      strlen($data)."\r\n");
   fputs($fp, "Connection: close\r\n\r\n");
   fputs($fp, "$data");
   while(!feof($fp))
   {
      $http_response.=fgets($fp, 128);
   }
   fclose($fp);

   list($http_headers, (http_content) =
      explode("\r\n\r\n", $http_response);

   return $http_content;
}
?>

Chris

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

Reply via email to