标签:style blog class code java c
1 <? 2 $url="http://www.feiin.com/registerForMobileForCode.act"; 3 4 $header[]= ‘Host: www.feiin.com‘; 5 $header[]= ‘User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0‘; 6 $header[]= ‘Accept: text/html, */*; q=0.01‘; 7 $header[]= ‘Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3‘; 8 $header[]= ‘Accept-Encoding: gzip, deflate‘; 9 $header[]= ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8‘; 10 $header[]= ‘X-Requested-With: XMLHttpRequest‘; 11 $header[]= ‘Pragma: no-cache‘; 12 $header[]= ‘Cache-Control: no-cache‘; 13 $header[]= ‘Referer: http://www.feiin.com/registerMobile.act‘; 14 $header[]= ‘Content-Length: 36‘; 15 $header[]= ‘Cookie: JSESSIONID=50344644B83729659713B02F2FBF3458; Hm_lvt_e7db37c8969981b3edf8650c5fde1002=1399690013; Hm_lpvt_e7db37c8969981b3edf8650c5fde1002=1399692027; IESESSION=alive; pgv_pvi=5491908608; pgv_si=s2348562432; __utma=264577560.507214264.1399690018.1399690018.1399692027.2; __utmc=264577560; __utmz=264577560.1399690018.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=264577560.1.10.1399692027‘; 16 $header[]= ‘Connection: keep-alive‘; 17 18 $curlPost=‘mobileNo=电话号码&smSecurityCode=‘; 19 $ch = curl_init(); //初始化curl 20 curl_setopt($ch, CURLOPT_URL, $url);//设置链接 21 curl_setopt($ch, CURLOPT_POST, 1);//post提交方式 22 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);//设置HTTP头 23 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //设置开启重定向支持 24 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ; // 获取数据返回 25 curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ; // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回 26 curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); 27 $output = curl_exec($ch) ; 28 curl_close($ch); 29 ?>
标签:style blog class code java c
原文地址:http://www.cnblogs.com/tudoudaqiang/p/3720245.html