Quote:
Originally Posted by CPA-Rush
image_url
|
That is the field name in the object but you have to reference the object to get at it:
object->fieldname
You are using xpath. That is only going to pull in the username field the way you have that coded. You could pull both fields you need using xpath but then each time you want to add a field you will have to screw with it.
Try this code instead. I cleaned up what you had there and changed it from using the xpath:
Code:
$users_to_show=array("xvectasss","delightcouple","banginbrooke","hitgirly","frenchie_noir");
$cams = new SimpleXMLElement('http://chaturbate.com/affiliates/api/onlinerooms/?format=xml&wm=AFFILIATELINK', null, true);
$online = false;
foreach ($cams as $user)
{
if(in_array(strtolower($user->username),$users_to_show))
{
echo '<div id="roomname_b"> ';
echo '<img src="' . $user->image_url . '">';
echo $user->username .' is online';
echo '<div class="site">';
echo '</div></span>';
$online = true;
}
}
if (!$online) echo ' <div id="null"> <strong>No rooms online . </strong></div>';