PHP local CURL is normal, but after put on SAE, objectmovedtohere login. php appears
Debug = 0; $ s = new SaeStorage (); $ domain = 'sdlg1'; $ filename = '/yzm/'; if ($ _ POST ['login']) {$ url =' http://210.44.176.134/ (Buoezbuq4apeu0v0151ruv55)/Default2.aspx '; $ data =' _ VIEWSTATE = '. urlencode ($ _ POST ['Stat']). '& txtUserName = '. urlencode ($ _ POST ['textbox1']). '& TextBox2 = '. urlencode ($ _ POST ['textbox2 ']). '& txtSecretCode = '. urlencode ($ _ POST ['textbox3']). '& RadioButtonList1 = '. urlencode ('student '). '& Button1 = & lbLanguage = & hidPdrs = & hidsc ='; $ data = iconv ("UTF-8", "GBK", $ data); $ ch = curl_init (); // $ proxy =" http://127.0.0.1:8087 "; If ($ proxy) {echo 'proxy'; curl_setopt ($ ch, CURLOPT_PROXY, $ proxy);} curl_setopt ($ ch, CURLOPT_URL, $ url ); curl_setopt ($ ch, CURLOPT_HEADER, 1); curl_setopt ($ ch, batch, 1); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt ($ ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.158888800.95 Safari/537.36 SE 2.X MetaSr 1.0"); curl_setopt ($ ch, CURLOPT_REFERER, $ url); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data);/* curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('proxy-Connection: keep-alive ', 'cache-Control: max-age = 0', 'Origin: http://210.44.176.133 ', 'Dnt: 1',); */echo''; $Headers = curl_getinfo($ch);print_r($Headers); $r = curl_exec($ch); curl_close($ch); print_r($r);//die; $pre = 'http://210.44.176.134/'; $pat = "/Location:(.*)/i"; preg_match($pat,$r,$m); $rurl = trim($m[1]); print_r($rurl); $rurl = $pre.''.substr($rurl,1); //location $r = $man->httpget($rurl,$url,0,array(),$proxy); //file_put_contents('main.txt',$r); $pre = 'http://210.44.176.134/(buoezbuq4apeu0v0151ruv55)/'; $pat = '/"; $infourl = trim($m[1]); echo $infourl = $pre.''.$infourl; $r = $man->httpget($infourl,$rurl,0,array(),$proxy); //file_put_contents('info.txt',$r); echo $r; }else{ //login $url = 'http://210.44.176.134/(buoezbuq4apeu0v0151ruv55)/Default2.aspx'; $r = $man->httpget($url,'',1,array(),$proxy); $pat = "/Location:(.*)/i"; preg_match($pat,$r,$m); $rurl = trim($m[1]); //file_put_contents('loginpage.txt',$r); //print_r($r);die; print_r($r);die; //GET __VIEWSTATE $pat = '/name="__VIEWSTATE" value="([^"]*)"/i'; preg_match($pat,$r,$m); $stat = $m[1]; //GET vocde $vocde_url = 'http://210.44.176.134/(buoezbuq4apeu0v0151ruv55)/CheckCode.aspx'; $r = $man->httpget($vocde_url,$url,0,array(),$proxy); $base=base64_encode($r);?>
Curlajax. class. php
Debug = 1; $ this-> ua = 'mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) chrome/28.0.158888800.95 Safari/537.36 SE 2.X MetaSr 1.0 ';} /***************************** get Request resource ** @ param string address *@ param string referer * @ param boolen whether the returned header * @ param array append cookie *********************** * ***/function httpget ($ url, $ referer = '', $ withhead = 1, $ httphead = array (), $ proxy ='') {$ ch = curl_init (); if ($ proxy) {curl_setopt ($ ch, CURLOPT_PROXY, $ proxy);} curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ this-> cookiejar ); curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ this-> cookiefile); curl_setopt ($ ch, CURLOPT_HEADER, $ withhead); curl_setopt ($ ch, expires, 1); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true); // curl_setopt ($ ch, CURLOPT_AUTOREFERER, 1);/* curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('proxy-Connection: keep-alive ', 'cache-Control: max-age = 0', 'Origin: http://210.44.176.133 ', 'Dnt: 1',); */curl_setopt ($ ch, CURLOPT_USERAGENT, $ this-> ua); curl_setopt ($ ch, CURLOPT_REFERER, $ referer ); $ r = curl_exec ($ ch); if ($ this-> debug) {echo''; Var_dump (curl_getinfo ($ ch);} curl_close ($ ch); return $ r ;} /***************************** post Request resource * @ param string address *@ param string referer * @ param array submit data * @ param boolen whether to return the header ************************ * ***/function httppost ($ url, $ referer = '', $ postdata = array (), $ withhead = 0, $ httphead = array (), $ proxy ='') {$ ch = curl_init (); if ($ proxy) {curl_setopt ($ ch, CURLOPT_PROXY, $ proxy);} curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_HEADER, $ withhead ); curl_setopt ($ ch, latency, 1); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true); // curl_setopt ($ ch, CURLOPT_AUTOREFERER, 1); curl_setopt ($ ch, CURLOPT_USERAGENT, $ this-> ua); curl_setopt ($ ch, CURLOPT_REFERER, $ referer); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ postdata ); $ r = curl_exec ($ ch); if ($ this-> debug) {echo''; var_dump(curl_getinfo($ch)); } curl_close($ch); return $r; }}
The corresponding information can be normally obtained locally. after it can be put on SAEs, the object is always moved to here,
The Location value in the information printed in row 49th of login. php on SAE is
Location:/(buoezbuq4apeu0v0151ruv55)/zdy.htm? Aspxerrorpath =/xs_main.aspx;
Normally, that is, the normal value obtained locally should be
Location:/(buoezbuq4apeu0v0151ruv55)/xs_main.aspx? X h = 1011125007
The younger brother really knows little about some things in curl .. Begging for the help of forum experts ....
This is the test address on my sae: http://1.sdlgwx.sinaapp.com/lg/login.php test account No.: 1011125007 password 111111
Reply to discussion (solution)Lord, have you solved your problem... I have the same problem as you... Exactly