user1593846
user1593846

Reputation: 756

How do I get text inside the xml tag

I got a xml document that looks like this:

<recenttracks user="xxxxxx" page="1" perPage="200" totalPages="2" total="233">
<track>
<artist mbid="160629ab-ec18-4931-8c95-02cb92d06186">Foreigner</artist>
<name>Long, Long Way From Home</name>
<streamable>1</streamable>
<mbid>1be3ee4b-98e7-4690-b872-ccabbccd09af</mbid>
<album mbid="4e1cf1f8-2383-434d-9125-6c28028db9d0">No End In Sight</album>
</track>

Now I need to get to the totalPages property inside now I know how to get the information between two tags for instance the name tag like this: $track->name but got no clue how to get the information inside a tag anyone?

Upvotes: 1

Views: 509

Answers (1)

Michal Klouda
Michal Klouda

Reputation: 14521

According to documentation, to get attribute value, use following syntax:

$recenttracks['totalPages'];

PS: I don't know anything about PHP Simple XML, I just heard about google, so I might be wrong.

Upvotes: 1

Related Questions