标签:
<?php $url="http://api.xxxx.com/api/articles/1138121/comments?strategy=hot"; $headers=array( ‘common-info:{"device_platform": "web","language":"tr","auth_type":1,"user_id":‘.3589775676782.‘, "version_code": 55}‘ ); $curl=curl_init();//初始话一个curl句柄 curl_setopt($curl,CURLOPT_URL,$url);//设置请求接口地址 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_NOBODY, FALSE);//设置只返回数据body curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);//设置header的参数 $result=curl_exec($curl); curl_close($curl); echo $result; ?>
标签:
原文地址:http://www.cnblogs.com/huyd/p/5468731.html