The load and parse of the xml feed in there is:
Code:
$userlist = simplexml_load_file('https://chaturbate.com/affiliates/api/onlinerooms/?
format=xml&wm=XXXXX');
if(empty($userlist))
{
die('Danger Will Robinson...xml load failed...aborting');
}
foreach ($userlist as $user)
{
Do something here
}
This opens the xml feed and loads it into a soimplexml object:
$userlist = simplexml_load_file('https://chaturbate.com/affiliates/api/onlinerooms/?format=xml&wm=JkjyU');
If we don't get anything back then lets just kill the routine
if(empty($userlist))
{
die('Danger Will Robinson...xml load failed...aborting');
}
Otherwise we read through the list of nodes returned and do something with the information:
foreach ($userlist as $user)
{
Do something here
}
So, that is a basic parse. There are other ways to pull this off. I usually use a curl routine to grab the xml feed. I do that because with curl I can control the connection timeout and process timeout. You could also use a file_get_contents to open the file and then load it to a simplexml object.
The main thing is that you want to get the data from the xml feed into the simplexml object to make it easier to read by just being able to loop through it.
.