logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: [php-source] PostToHost
Author
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Sun 13 Aug '06 20:19    Post subject: [php-source] PostToHost Reply with quote

The following code can be usefull, cause it send the $data realy with POST

Code:

function PostToHost($host, $path, $referer, $data_to_send) {
$fp = fsockopen($host, 80);
printf("Open!\n");
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Referer: $referer\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data_to_send);
printf("Sent!\n");
while(!feof($fp)) {
$res .= fgets($fp, 128);
}
printf("Done!\n");
fclose($fp);

return $res;
}


$data = "pid=14&poll_vote_number=2";

printf("Go!\n");
$x = PostToHost(
"www.linux.com",
"/polls/index.phtml",
"http://www.linux.com/polls/index.phtml?pid=14",
$data
);
Back to top


Reply to topic   Topic: [php-source] PostToHost View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner