【发布时间】:2014-06-08 06:03:00
【问题描述】:
我正在尝试在 codeigniter 中获得结果,但此代码没有输出任何内容。 有没有人在codeigniter中有解决方案。 我需要一些提示。
$url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&"
. "q=Paris%20Hilton&userip=USERS-IP-ADDRESS";
// 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, /* Enter the URL of your site here */);
$body = curl_exec($ch);
curl_close($ch);
// now, process the JSON string
$json = json_decode($body);
// now have some fun with the results...
【问题讨论】:
-
你想要的输出是什么?实际输出是多少?请提供更多详细信息。
-
试试 echo curl_error($ch);在 curl_close($ch) 之前;查看任何卷曲错误
标签: php json codeigniter