you can try this:

$sock = fsockopen($parse_url['host'], $parse_url['port'], $errno, $errstr, 30);
if (!$sock) {
       die("$errstr ($errno)\r\n");
}

$tmp = explode('&',$parse_url['query']);
$data = NULL;
foreach($tmp as $val) {
       $p = explode('=',$val);
       if(empty($data)) {
               $data  = $p[0] . "=" . urlencode($p[1]);
       } else {
               $data .= "&" . $p[0] . "=" . urlencode($p[1]);
       }
}

fwrite($sock, "POST " . $parse_url['path'] . " HTTP/1.0\r\n");
fwrite($sock, "Host: " . $parse_url['host'] . "\r\n");
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sock, "Content-length: " . strlen($data) . "\r\n");
fwrite($sock, "Accept: */*\r\n");
fwrite($sock, "\r\n");
fwrite($sock, "$data\r\n");
fwrite($sock, "\r\n");

$body = "";
while (!feof($sock)) {
       $body .= fgets($sock, 4096);
}

fclose($sock);

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

Reply via email to