【发布时间】:2014-02-10 03:12:44
【问题描述】:
我尝试在 yahoo curl 服务上测试 php_curl,但我从 yahoo 收到错误消息。
// create a new cURL resource
$handle = curl_init();
// set URL and other appropriate options
// http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=persimmon&results=10
curl_setopt_array(
$handle,
array(
CURLOPT_URL => 'http://search.yahooapis.com/WebSearchService/V1/webSearch',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => 'appid=YahooDemo&query=test&results=10',
CURLOPT_RETURNTRANSFER => true
)
);
$response = curl_exec($handle);
curl_close($handle);
$xml = new SimpleXMLElement($response);
foreach($xml->Result as $x) {
echo $x->Title.'<br/>';
}
echo '<pre>';
print_r($xml);
结果:
SimpleXMLElement Object
(
[Message] => The service has been shut down. For further details, please see the Deprecated Services blog post http://developer.yahoo.com/blogs/ydn/posts/2010/08/api_updates_and_changes
)
任何从雅虎检索搜索数据的示例因为该服务已被弃用?似乎需要他们的BOSS API 付款。
googel api 怎么样 - 如果我想从 google 获取搜索数据,我可以去哪里?
【问题讨论】: