PHP Fsockopen fake post and get methods _php tutorial

Source: Internet
Author: User
Tags fread
This article provides you with a PHP tutorial Fsockopen fake post and Get methods Oh, if you are looking for a fake post and get method of PHP processing code this is good OH.

Fsocket Analog Post Submission
$purl = "Http://localhost/netphp/test2.php?uu=rrrrrrrrrrrr";
Print_r (Parse_url ($url));
Sock_post ($purl, "uu=55555555555555555");

Fsocket Analog Get Commit
function Sock_get ($url, $query)
{
$info = Parse_url ($url);
$fp = Fsockopen ($info ["host"], $errno, $ERRSTR, 3);
$head = "GET". $info [' Path ']. "?". $info ["Query"]. " Http/1.0rn ";
$head. = "Host:". $info [' Host ']. " RN ";
$head. = "RN";
$write = fputs ($fp, $head);
while (!feof ($FP))
{
$line = Fread ($fp, 4096);
Echo $line;
}
}
Sock_post ($purl, "uu=rrrrrrrrrrrrrrrr");

function Sock_post ($url, $query)
{
$info = Parse_url ($url);
$fp = Fsockopen ($info ["host"], $errno, $ERRSTR, 3);
$head = "POST". $info [' Path ']. "?". $info ["Query"]. " Http/1.0rn ";
$head. = "Host:". $info [' Host ']. " RN ";
$head. = "referer:http://". $info [' Host ']. $info [' Path ']. RN ";
$head. = "CONTENT-TYPE:APPLICATION/X-WWW-FORM-URLENCODEDRN";
$head. = "Content-length:". strlen (Trim ($query)). " RN ";
$head. = "RN";
$head. = Trim ($query);
$write = fputs ($fp, $head);
while (!feof ($FP))
{
$line = Fread ($fp, 4096);
Echo $line;
}
}

?>


http://www.bkjia.com/PHPjc/444965.html www.bkjia.com true http://www.bkjia.com/PHPjc/444965.html techarticle This article provides you with a PHP tutorial Fsockopen fake post and Get methods Oh, if you are looking for a fake post and get method of PHP processing code this is good.? PHP//fsocket analog post lift ...

  • 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.