PHP Code
*/$post _fields = Array (), $post _fields = Preg_data ($contents, ' aid ', $post _fields); $post _fields = Preg_data ($contents, ' Isphone ', $post _fields); $post _fields[' mem_pass '] = ' on '; The post data array remembers my login status $post_fields = Preg_data ($contents, ' More_param ', $post _fields); $post _fields = Preg_data ($contents , ' Need_coin ', $post _fields); $post _fields = Preg_data ($contents, ' Need_pay ', $post _fields); $post _fields = Preg_data ($ Contents, ' Next_target ', $post _fields); $post _fields[' password '] = ' password '; The post data array remembers my login status $post_fields = Preg_data ($contents, ' Pay_method ', $post _fields); $post _fields = Preg_data ($contents , ' Psp_tt ', $post _fields); $post _fields = Preg_data ($contents, ' Return_method ', $post _fields); $post _fields = Preg_data ( $contents, ' Return_type ', $post _fields), $post _fields = Preg_data2 ($contents, ' safeflg ', $post _fields); $post _fields = Preg_data ($contents, ' Skip_ok ', $post _fields), $post _fields = Preg_data ($contents, ' TPL ', $post _fields); $post _fields = Preg_data ($contents, ' Tpl_ok ', $post _fields); $post _fields[' u '] = 'http://www.baidu.com/'; $post _fields[' username ') = ' username '; Post data array Remember my login status $post_fields[' verifycode ' = '; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ( $ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_post, 1); Curl_setopt ($ CH, curlopt_postfields, $post _fields); curl_setopt ($ch, Curlopt_cookiejar, $cookdir); curl_setopt ($ch, Curlopt_ UserAgent, "mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. NET CLR 1.1.4322;. NET CLR 2.0.50727); curl_setopt ($ch, Curlopt_referer, "Https://passport.baidu.com/?login &tpl=mn "), Curl_exec ($ch), Curl_close ($ch), $url =" http://www.baidu.com/"; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_cookiefile, $cookdir); curl_setopt ($ch, Curlopt_useragent, "mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. NET CLR 1.1.4322;. NET CLR 2.0.50727); curl_setopt ($ch,Curlopt_referer, "http://www.baidu.com/n"), $contents = Curl_exec ($ch);p rint_r ($contents);d ie;curl_close ($ch); exit function Preg_data ($source, $CHR, $array) {Preg_match ('/
I/I ', $source, $matches); if (!empty ($matches)) {$a = $matches [1]; } else {die (' not found the '. $chr. '); } $array [$CHR]= $a; return $array;} function Preg_data2 ($source, $CHR, $array) {Preg_match ('/
I/I ', $source, $matches); if (!empty ($matches)) {$a = $matches [1]; } else {die (' not found the '. $chr. '); } $array [$CHR]= $a; return $array;}?
>