Hallo,
ich versuche gerade das erste mal mit Yahoo Web Search Service Suchergebnisse abzufragen.
Der Code sieht wie folgt aus:
Code:
try {
$request='http://api.search.yahoo.com/WebSearchService/V1/webSearch?
appid=MYYAHOOID&query=Madonna&results=2&output=php';
// trigger the http request
if (!$results = file_get_contents($request)) {
throw new Exception('Error requesting Yahoo! Web service');
}
$results = unserialize($results);
foreach ($results[ResultSet][Result] as $result) {
echo '<h2>'.$result[Title].'</h2><p>'.$result[Summary].'</p><a href="'.$result
[Url].'">'.$result[Url].'</a>';
}
} catch(Exception $e) {
echo $e->getMessage();
exit();
}
Leider bekomme ich folgende Fehlermeldung:
Warning: file_get_contents(
http://api.search.yahoo.com/WebSearc.../V1/webSearch? appid=MYYAHOOID&query=Madonna&results=2&output=php) [
function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in
.../myURLtest.php on line
18
Error requesting Yahoo! Web service
Hat jemand eine Idee, was da falschen sein könnte? Vielen Dank!
Grüße
Stephan