-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返回搜索數據,我該去哪裏?