Jump to content

Recommended Posts

Can anyone tell me how it is possible to parse the "totalResults" item in and OpenSearch XML document such as this one:

http://ws.audioscrobbler.com/2.0/?api_key=c7d55f27a911c6a0f77040f18758fc5a&method=artist.search&artist=ehfdfjfgjvhfgndfobndfhnfdgnhdfh

 

I've been working on it for about 2 hours and I can't seem to figure it out ???

 

So far I have:

 

<?php
$lastFM_url = 'http://ws.audioscrobbler.com/2.0/?api_key=c7d55f27a911c6a0f77040f18758fc5a&method=artist.search&artist=';
$lastFM_search_results = $lastFM_url.$artist_query;

// read feed into SimpleXML object
      $lastFM_searchXML = simplexml_load_file($lastFM_search_results);
      
      // get summary counts from opensearch: namespace
      $counts = $lastFM_searchXML->results->children('http://a9.com/-/spec/opensearchrss/1.0/');
      $total = $counts->totalResults;  

?> 

 

Anyone have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/155115-parsing-opensearch-xml-data/
Share on other sites

Taking this feed for example:

http://ws.audioscrobbler.com/2.0/?api_key=c7d55f27a911c6a0f77040f18758fc5a&method=artist.search&artist=muse

 

I'm simply trying to extract the <opensearch:totalResults> of the feed. Because of the structure of this feed is different to all others I have worked with (this is an OpenSearch feed), its proving difficult to understand and get the correct syntax for extracting that element of the feed.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.