Shockwave Flash Object Download PHP socket submission Post details

Source: Internet
Author: User
/*
* * Post message to host
*/
function Posttohost ($url, $data) {
$url = Parse_url ($url);
if (! $url) return "couldn\ ' t parse url";
if (!isset ($url [\ ' port\ ')) {$url [\ ' port\ '] = "";}
if (!isset ($url [\ ' query\ ')) {$url [\ ' query\ '] = "";}
$encoded = "";
while (list ($k, $v) = each ($data)) {
$encoded. = ($encoded? "&": "");
$encoded. = Rawurlencode ($k). " = ". Rawurlencode ($v);
}
$port = $url [\ ' port\ ']? $url [\ ' port\ ']: 80;
$fp = Fsockopen ($url [\ ' host\ '], $port, $errno, $ERRSTR);
if (! $fp) return "Failed to open socket to $url [host] $port ERROR: $errno-$errstr";
Fputs ($FP, sprintf ("POST%s%s%s http/1.0\\n", $url [\ ' path\ '], $url [\ ' query\ ']? "?": "", $url [\ ' query\ ']));
Fputs ($FP, "Host: $url [host]\\n");
Fputs ($fp, "content-type:application/x-www-form-urlencoded\\n");
Fputs ($FP, "Content-length:".) Strlen ($encoded). "\\n");
Fputs ($fp, "connection:close\\n\\n");
Fputs ($fp, "$encoded \\n");
$line = fgets ($fp, 1024);
if (!eregi ("^http/1\\. ", $line)) return;
$results = ""; $inheader = 1;
while (!feof ($fp)) {
$line = fgets ($fp, 1024);
if ($inheader && ($line = = "\\n" | | $line = = "\\r\\n") {
$inheader = 0;
}
ElseIf (! $inheader) {
$results. = $line;
}
}
Fclose ($FP);
return $results;
}/* End Function Posttohost */
?>

The above describes the Shockwave Flash Object download PHP socket submission of the post details, including the Shockwave Flash object download content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.