/    Sign up×
Community /Pin to ProfileBookmark

Help parsing remote xml using php

Hi all. There is a remote rss xml as shown. i wonder how i can parse it in php so that i can construct the following
echo statement:

echo “artist0=artistname0&name0=songname0&Image0=http://www.somesite.com/pic0.jpg&artist1=artistname1&name1=songname1&Image1=http://www.somesite.com/pic1.jpg&….artist10=…”;

There are 10 items in this xml at all time. I be happy if some one show me how achive this task.Thanks

php code:

[code]
<?php

$xml = file_get_contents(‘your-xml-file.xml’);

……………..

echo “artist0=artistname0&name0=songname0&Image0=http://www.somesite.com/pic0.jpg&artist1=artistname1&name1=songname1&Image1=http://www.somesite.com/pic1.jpg&….artist10=…”;

?>
[/code]

remote rss xml format:

[code]
<playlist>
<song>
<artist>artistname0</artist>
<name>songname0</name>
<image>http://www.somesite.com/pic0.jpg</image>
<rating>3.26667</rating>
<songid>3043</songid>
<totalvotes>15</totalvotes>
</song>
<song>
<artist>artistname1</artist>
<name>songname1</name>
<image>http://www.somesite.com/pic1.jpg</image>
<rating>5</rating>
<songid>4935</songid>
<totalvotes>3</totalvotes>
</song>
….
….
</playlist>

[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @method spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...