首頁  >  文章  >  後端開發  >  直接存取連結有資料,CURL GET 一片空白

直接存取連結有資料,CURL GET 一片空白

WBOY
WBOY原創
2016-08-08 09:06:451775瀏覽

$url='http://114.215.198.210:8081/a...';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_chET, $url);
curl_setopt($chUR, CUR CUR3, UR CUR CUR CUR C. ); // 要求結果為字串且輸出到螢幕上

curl_setopt($ch, CURLOPT_HEADER, 0); // 不要http header 加快效率curl_setopt($ch, CURLOPT_TIMEOUT, 15);

echo $ $ch);

curl_close($ch);



回覆內容:

$url='http://114.215.198.210:8081/a...';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_chET, $url);

curl_setopt($chUR, CUR CUR3, UR CUR CUR CUR C. ); // 要求結果為字串且輸出到螢幕上

curl_setopt($ch, CURLOPT_HEADER, 0); // 不要http header 加快效率

curl_setopt($ch, CURLOPT_TIMEOUT, 15);🎜echo $ $ch);🎜curl_close($ch);🎜 🎜 🎜我試了下怎麼沒問題:🎜
<code>➜  /tmp php test.php
{"status":"0","msg":"操作成功","result":{"locationTimeStamp":1468311789000,"address":"广东省深圳市南山区高新南三道靠近真功夫(南山科技园店)","stepValue":0,"calory":0,"distance":0,"radius":70,"deviceId":"666666666666675","battery":66,"positionType":2,"lat":22.538201,"lng":113.952924},"timestamp":1470463701045}%</code>
🎜test.php就是你貼文的程式碼:🎜
<code><?php
    $url='http://114.215.198.210:8081/api_v1/holder/getCurrentInfo?currentDate=2015-10-01%2016:10:53&access_token=7ede29d0-bac6-4657-a754-fdfc4801bb72&userId=15820466773&deviceId=666666666666675';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 要求结果为字符串且输出到屏幕上
    curl_setopt($ch, CURLOPT_HEADER, 0); // 不要http header 加快效率
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    echo $output = curl_exec($ch);
    curl_close($ch);
?></code>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn