-6
我试图在雅虎curl服务上测试php_curl,但我从雅虎收到错误。PHP cURL:从yahoo/google api检索搜索数据?
// 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返回搜索数据,我该去哪里?