php链接get数据,直接访问链接有数据,CURL GET 一片空白

$url=’http://114.215.198.210:8081/a…’;

$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);

我试了下怎么没问题:

➜  /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}%

test.php就是你帖的代码:

<?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);

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值