View Single Post
Old 11-30-2014, 08:57 AM  
CPA-Rush
small trip to underworld
 
Industry Role:
Join Date: Mar 2012
Location: first gen intel 80386/nintendo-gb/arcade/ps1/internet person
Posts: 4,927
Quote:
Originally Posted by sarettah View Post
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>';
the array

works no problem .. tested it with both sites
thanks!
__________________

automatic exchange - paxum , bitcoin,pm, payza

. daizzzy signbucks caution will black-hat black-hat your traffic

ignored forever :zuzana designs
CPA-Rush is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook