직접 액세스 링크에 데이터가 있지만 CURL GET이 비어 있습니다.

WBOY
풀어 주다: 2016-08-08 09:06:45
원래의
1776명이 탐색했습니다.

$url='http://114.215.198.210:8081/a...';
$ch = 컬_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 결과를 문자열로 요구하고 화면에 출력합니다
curl_setopt($ch, CURLOPT_HEADER, 0) // 효율성을 높이기 위해 http 헤더를 사용하지 마세요
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
echo $output = 컬_exec($ch);
curl_close($ch);

답글 내용:

$url='http://114.215.198.210:8081/a...';
$ch = 컬_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 결과를 문자열로 요구하고 화면에 출력합니다
curl_setopt($ch, CURLOPT_HEADER, 0) // 효율성을 높이기 위해 http 헤더를 사용하지 마세요
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
echo $output = 컬_exec($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>
로그인 후 복사
관련 라벨:
php
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!