0
我試圖做到這一點PHP捲曲的谷歌API不工作,但的file_get_contents確實
$url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&"
. "q=Paris%20Hilton&userip=$_SERVER[SERVER_ADDR]";
// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://google.com');
$body = curl_exec($ch);
curl_close($ch);
// now, process the JSON string
$json = json_decode($body);
// now have some fun with the results...
這是從他們的文檔非常簡單的,但它似乎並沒有返回任何東西,但的file_get_contents完成了同樣的網址只是不是https,但http
我只用http捲曲也沒有運氣。 任何幫助表示讚賞你們:)
使用'curl_error($ ch)'進行調試。我敢打賭,因爲你的cabundle.crt過時了。 – 2013-07-19 23:51:39