Quote:
Originally Posted by funnytimecpl
want to show my cam embed and when i'm not online , to show best cam , embed
|
Ok, that is easy enough.
The iframe embed for the chatroom is in the feed so we will use that one for your room.
The best converting url is not provided in the feed. On the link page it has a link but not an iframed link so don't know off hand if you use that link if it might not break out of an iframe if you put it in there, you would have to play with that.
Or you can use one of the precoded iframes at
https://chaturbate.com/affiliates/promotools/embed/ such as the top chat room.
Using what we had above just change out the vars we are outputting with the proper vars from the feed.
Code:
<?php
$users_to_show=array("yourusername");
// my top rooom iframe from the links page
$top_room_iframe="<iframe src='https://chaturbate.com/affiliates/in/dTm0/JkjyU/?track=embed&bgcolor=white' height=528 width=850 style='border: none;'></iframe>";
$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))
{
// for free
//echo $user->iframe_embed;
// or for revshare
echo $user->iframe_embed_revshare;
$online = true;
}
}
if (!$online) echo $top_room_iframe;
?>
Something like that should do it
btw, that is far from the most efficient manner to pull this stuff off. Doing it this way requires pulling the feed and going through every record until it finds the right user(s) every time the page gets hit.
Much more efficient to throw the data into a database structure periodically and then grab the exact record you need when you want it. Just my
.