Q:

fail to use web service with php

I am using this site as a guide to my webservice..
http://developer.yahoo.com/answers/V1/questionSearch.html

and I use this code:
$client=new SoapClient("http://answers.yahooapis.com/AnswersService/V1/questionSearch");
$resposeArray=$client->__call("query","economics");

var_dump($resposeArray);

Apparently, I fail to retrieve anything.. and get this error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://answers.yahooapis.com/AnswersService/V1/questionSearch' : failed to load external entity "http://answers.yahooapis.com/AnswersService/V1/questionSearch" in C:\xampp\htdocs\Unnamed Site 2\untitled1.php:11 Stack trace: #0 C:\xampp\htdocs\Unnamed Site 2\untitled1.php(11): SoapClient->SoapClient('http://answers....') #1 {main} thrown in C:\xampp\htdocs\Unnamed Site 2\untitled1.php on line 11

A:

For the webservice to work with your code, PHP must be able to obtain the external file:
http://answers.yahooapis.com/AnswersService/V1/questionSearch

However that file doesn't work any longer and gives back an error:
HTTP/1.1 503 Service Unavailable
Date: Mon, 19 Dec 2011 15:42:30 GMT
Retry-After: 1324339200
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: application/xml;charset=utf-8
Cache-Control: private

<?xml version="1.0" encoding="utf-8"?> <yahoo:error xmlns:yahoo="http://yahooapis.com/v1/base.rng" xml:lang="en-US"> <ya
hoo:description>Rate Limit Exceeded</yahoo:description> <yahoo:detail>Key has exceeded its configured rate limit.</yahoo
:detail> </yahoo:error>

So the client can't proceed. Replace it with a working version and try again. It looks like that the URL needs some key, probably with a cookie/header or something, I'm not familiar with that specific webservice.

