[英]php curl for Google api not working but file_get_contents does
[英]PHP CURL funcion is not working for google timezone api
PHP curl函數從Google時區api中獲取任何信息。
<?php
$url='https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810,-119.6822510×tamp=1331161200&sensor=false';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);
$dta = curl_exec($ch);
curl_close($ch);
print_r( $dta);
?>
print_r( $dta);
什么都不打印。
它給出結果。
我應該如何從鏈接中檢索內容? 誰能幫我?
沒有錯誤,但是Google說了什么
請檢查卷曲錯誤並解決
<?php
$url='https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810,-119.6822510×tamp=1331161200&sensor=false';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
print_r($data);
if(curl_errno($ch)) echo 'Curl error: ' . curl_error($ch);
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.