3. $post_string = “app=request&version=beta”;
* request_by_curl(‘
http://hu60.cn /wap/index.php’,$post_string);
*/
function actionPost($url,$data){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_COOKIEFILE, ‘cookie.txt’);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$tmpInfo = curl_exec($curl);
if (curl_errno($curl)) {
echo ‘Errno’.curl_error($curl);
}
curl_close($curl);
return $tmpInfo;
}
8.
@thb,学了1个多小时就这效果了 不得不说是编程的奇才。
10. 楼主好像也没说是PHP零基础,可能只是学会用curl发帖了
11.
@net909,大哥,没基础,不会点HTTP协议和编码的基础知识,你胡闹呢!!