You are here: Re: [PHP] Re: Sending post data from a script « PHP « IT news, forums, messages
Re: [PHP] Re: Sending post data from a script

Posted by glumtail on 08/06/05 12:34

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);

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация