1 <?php 2 3 function login(){ 4 $url = 'http://jspatch.qq.com/offline/check?qver=6.2.0.427&hver=0&biz=2164&pf=2&uin=3323687546&osrelease=9.1&mask=0'; 5 $data='{}'; 6 $curl = curl_init (); //初始化句柄 7 curl_setopt ($curl, CURLOPT_URL,$url); //设置请求的url 8 curl_setopt ( $curl, CURLOPT_CUSTOMREQUEST, 'GET'); //设置请求方式 9 curl_setopt($curl, CURLOPT_PUT, 1); 10 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设为TRUE把curl_exec()结果转化为字串,而不是直接输出 11 curl_setopt ( $curl, CURLOPT_HEADER, 0 ); 12 $header=array(); 13 curl_setopt ( $curl, CURLOPT_HTTPHEADER, $header ); //设置http头信息 14 curl_setopt ( $curl, CURLOPT_POSTFIELDS, $data ); //设置提交的参数 15 $res = curl_exec ( $curl ); //执行 16 curl_close ( $curl ); //关闭 17 $result=json_decode($res,true); 18 print_r($res); 19 } 20 21 login();