私は lastfm API を使用しており、アーティスト検索の検索結果をページ分割できるようにしたいと考えています。
<results xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" for="cher">
<opensearch:Query role="request" searchTerms="cher" startPage="1"/>
<opensearch:totalResults>1302</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>30</opensearch:itemsPerPage>
totalresults ノードを取得し、それをページごとのアイテムで割ることが必要になると思います。しかし、php を使用して totalresults から情報を取得するにはどうすればよいですか?
これ$artists = $xml->results->artistmatches->artist;
がアーティストを取得する方法である場合、正しい opensearch ノードの合計結果とページごとのアイテムを取得するにはどうすればよいですか?