PHP cannot simulate the POSTaspx page. how can this problem be solved?

Source: Internet
Author: User
If the PHP simulation POSTaspx page fails, the following instance returns & nbsp; Yes & nbsp; 0 | access restriction! Please reload the page and place it back & nbsp;-2 | incorrect license plate number & lt ;? /*************************************** * *************************** Php post aspx page simulation fails
The following instance returns yes 0 | access restriction! Please reload the page
Should be put back -2 | incorrect license plate number


/*************************************** *********************************
Name: POST test program Vesion: 1.0 Date:
**************************************** *********************************/
$ Keyimg = $ _ POST ['keyimg '];
If ($ keyimg ){
???? $ Flag = 0;
???? // Data to be post
???? $ Argv = array (
???????? 'Action' => 'illagel ',
???????? 'Back4' => '123 ',
???????? 'Headno' => 'yue ',
???????? 'No' => 'last32 ',
???????? 'Type' => '02 ',
???????? 'Validate' => $ keyimg ????
????????);
???? // Construct the string to post
???? Foreach ($ argv as $ key => $ value ){
???????? If ($ flag! = 0 ){
???????????? $ Params. = "&";
???????????? $ Flag = 1;
????????}
???????? $ Params. = $ key. "= ";
???????? $ Params. = urlencode ($ value );
???????? // $ Params. = $ value;
???????? $ Flag = 1;
????}
???? Echo $ params;
???? $ Length = strlen ($ params );
???? // Create a socket connection
???? $ Fp = fsockopen ("www.gdhzcgs.com", 80, $ errno, $ errstr, 10) or exit ($ errstr. "--->". $ errno );
???? // Construct the post request header
???? // $ Header = "POST/Illegal. aspx HTTP/1.1 \ r \ n ";
???? $ Header = "POST/Ajax. aspx HTTP/1.1 \ r \ n ";
???? $ Header. = "Host: www.gdhzcgs.com \ r \ n ";
???? $ Header. = "Referer: www.gdhzcgs.com/illegal.aspx?r=n ";
???? $ Header. = "Content-Type: application/x-www-form-urlencoded \ r \ n ";
???? $ Header. = "Content-Length:". $ length. "\ r \ n ";
???? $ Header. = "Connection: Close \ r \ n ";
???? // Add the post string
???? $ Header. = $ params. "\ r \ n ";
???? // Send post data
???? Fputs ($ fp, $ header );
???? $ Inheader = 1;
???? While (! Feof ($ fp )){
???????? $ Line = fgets ($ fp, 1024); // only the returned data on the page is displayed when the request packet header is removed.
???????? If ($ inheader & ($ line = "\ n" | $ line = "\ r \ n ")){
???????????? $ Inheader = 0;
????????}
???????? If ($ inheader = 0 ){
???????????? Echo $ line;
????????}
????}
???? Fclose ($ fp );
}
Else {
Echo 'keyimg = Null ';
}
?>





Internet Vehicle Management Office




Share: More

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.