Page 1 of 1

data inside xml string

Posted: Wed Apr 07, 2010 9:56 am
by roice
Hello,
The following link will give you the number of the Inbound link to some url:
http://search.yahooapis.com/SiteExplore ... output=xml

In the top you can find "totalResultsAvailable=14370725"
how can I get the number into varibale?

I tried this:

Code: Select all

$resp = file_get_contents("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=YahooDemo&query=http://www.cnn.com&omit_inlinks=domain&output=xml");
$xml = simplexml_load_string($resp);
echo $xml->ResultSet['totalResultsAvailable'];
But its not working...:/

Re: data inside xml string

Posted: Wed Apr 07, 2010 10:09 am
by Technocrat
You were SO close.

Code: Select all

$resp  = file_get_contents("http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=YahooDemo&query=http://www.cnn.com&omit_inlinks=domain&output=xml");
$xml = simplexml_load_string($resp);
echo (string)$xml['totalResultsAvailable'];

Re: data inside xml string

Posted: Thu Apr 08, 2010 2:17 am
by roice
Thank you,
It's working.