If the PHP simulation POSTaspx page is unsuccessful, the following instance returns 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
Reply to discussion (solution)
With curl, you don't have to build your own wheels.
With curl, you don't have to build your own wheels.
Curl
Http://www.gdhzcgs.com/Ajax.aspx
Also return
0 | access restriction! Please reload the page
Request Headers Value
(Request-Line) POST/Ajax. aspx HTTP/1.1
X-requested-with XMLHttpRequest
Accept-Language zh-CN
Referer http://www.gdhzcgs.com/Illegal.aspx
Accept */*
Content-Type application/x-www-form-urlencoded
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host www.gdhzcgs.com
Content-Length 69
Connection Keep-Alive
Cache-Control no-cache
Cookie ASP. NET_SessionId = response; CNZZDATA3614737 = cnzz_eid = 42940778-1356920353-& ntime = 1343020353 & cnzz_a = 0 & retime = 1343020354714 & sin = & ltime = 1343020354714 & rtime = 0
Cookie available ..
Find an HTTPWATCH to completely simulate the access process. it is easy for new users to ignore AJAX access ..
This also needs to simulate that many sessions are hidden and generated by AJAX "secret". we need to dig it out ..
More complex, sometimes we need to look at its JS code. I have a solution. follow httpwatch to simulate access completely.
I encountered the same problem during cross-origin access. excuse me, what method did the landlord use to solve the problem?