![]() |
script to show if specific room is online , i need to add feature
<?php
$cams = new SimpleXMLElement('http://chaturbate.com/affiliates/api/onlinerooms/?format=xml&wm=AFFILIATELINK', null, true); $online = false; foreach ($cams->xpath('//username') as $username) { if ($username == "xvectasss" || $username == "delightcouple" || $username == "banginbrooke" || $username == "hitgirly" || $username == "frenchie_noir"){ echo '<div id="roomname_b"> '. $username .' is online <div class="site"> '; echo '</div></span>'; $online = true; } } if (!$online) echo ' <div id="null"> <strong>No rooms online . </strong></div>'; ?> i want to add small live pic next to model name :) how i can achieve this ? thanks |
echo '<div id="roomname_b"> ';
echo "<img src=" . imageurl .">"; echo $username .' is online <div class="site"> '; echo '</div></span>'; Where imageurl is the image src element from the xml object. I do not remember the field name in the chaturbate feed right now. . |
Quote:
not working man :).. i have been doing this for 24 hrs :thumbsup its not working with bonga too <?php $cams = new SimpleXMLElement('http://tools.bongacash.com/promo.php?c=aff&type=api&api_type=xml', null, true); $online = false; foreach ($cams->xpath('//username') as $username) { if ($username == "SweetladyX" || $username == "Marusyya" || $username == "ukrainka" || $username == "AngelicRos3"){ echo '<div id="roomname_c"> '; echo "<img src=" . profile_images>thumbnail_image_small_live .">"; echo $username .' is online <div class="site"> BongaCam '; echo '</div></span>'; $online = true; } } if (!$online) echo ' <div id="null"><strong><br> No rooms online Bongacams. <br/></strong></div>'; ?> i'm giving u 0.002636 btc if u can get it right :winkwink: :thumbsup |
Quote:
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"); |
can you guys point me in a direction on how can i make this code to work this way ?
show my cam when i'm online , else show Best Converting Tour ? |
Quote:
Code:
$users_to_show=array("myusername"); . |
Quote:
works no problem .. tested it with both sites thanks! http://smileys.on-my-web.com/reposit...ct/cup-006.gif |
Quote:
That always surprises the fuck out of me ;p . |
my bad, this looks similar to nomoneyinporn script , and wanted to implement it in my site:)
|
Quote:
Easy enough to do it in just about any version of a chaturbate script. . |
want to show my cam embed and when i'm not online , to show best cam , embed
|
Quote:
:thumbsup |
Quote:
I always test but you can never test enough ;p btw, I tried to reply to your last pm and it says your box is full. But thanks, got it. . |
Quote:
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 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 :2 cents: . |
Quote:
ok deleted some messages , yw . |
it works on a blank page , but cant manage to make it only on first page :(
take a look if you have time cbgtube.com Code:
<?php @CPA-Rush sorry for hijacking your thread ! |
funnytimecpl, here is what I think might be a much more efficient way for you to do what you are trying to do.
One note, if you are already running something like nomoneyinporn's script then this could probably be integrated right into it, not sure where without reviewing the script some. First, let's split it into 2 parts. The first part will run from cron periodically. You could set it for once a minute, once every 2, whatever. In the cron piece, we pull in the feed. Check to see if we are online. Write a file if we are on line. If we are not on line we delete the online file if it is there. End of program. Make a folder in your domain space on the server called online. Put this code (with the proper modifications to the vars) into a php file in the online folder: Code:
<?php Or you can put some htaccess in there allowing just the server and your ip to have access that way the cron can run and you can test from a browser but noone else can access it. Set up your cron to run that php file however often you want to run it. Now, wherever you want the embedded room to appear, instead of all the other code we did earlier use something like: Code:
<?php The other issue that started this thread could be handled that way as well, with a little modification to handle the multiple usernames being checked for, etc.... Hope that helps. . |
Quote:
jk :upsidedow |
Quote:
Will look when I get a chance. . |
Quote:
If you can live with your "Hey Perv...." being above your embed then what might work is to put your embed in the tpl_home function. I am assuming that the tpl_home only gets called for the home page and that home page is your first page. I dould be wrong, I often am. ;p Code:
If you can't live with that and must have the "Hey Perv..." below the embed then in the header you will have to check what page is being called for and only present it on pages you want. The page being called is in $_SERVER['REQUEST_URI']; so you would have to interrogate that to see if you are on the first page or not before doing the presentation of the embed. Also, if you use the code we have been doing here you will be pulling the xml feed multiple times needlessly. Somewhere in your stuff you are already pulling the xml feed. best would be to modify that piece to give you an online indicator to call on later. . |
@ CPA-Rush , if i did , that means that you do good posts . lol , dont want to spam the board :D
@sarettah thank you for your support , i did manage to do something in the end , after a lot of coffee and stress , decided to let only the top chat room. Again thanks . you do usefull posts :D |
Quote:
It should not be real hard to make mods like I suggested. I can help you out on that. Went to send you a pm but it doesn't look like your pms are enabled yet. Anyway, if you want me to take a look let me know. sarettah at hatterasdesigns dot com. . |
i'm gonna mail you soon !
|
Quote:
For info for anyone reading this thread. I have several errors in the code here. Comes from throwing it up quickly while doing a project in another language. Shit happens you know. ;p Here is a fix for the code in the top code box: Code:
<?php |
sarettah , lets say i want check if some users watch the room right now ?
$users_to_show=array("jully_rebella","natyhot29"," sexypenis75"); // users $room = 'https://chaturbate.com/api/getchatuserlist/?sort_by=t&roomname=natyhot29'; // userlist of the room ....SOMECODE if true echo '<div id="users_to_show"> - are in room '; echo '</div></span>'; else echo ' <div id="null"> <strong>Not in room . </strong></div>'; can u guide me ? :) |
Quote:
You could scrape a page and pick up that information perhaps. . |
Quote:
curious would this be easier if it was html page ? |
Quote:
The way I see to get at that info is to periodically grab the code for the page you want to monitor, search it for the list of users viewing and interrogate that. Now, that info may or may not be available in a page scrape. If the list is injected via javascript it is harder to get at. . |
Quote:
this is more clear now :) |
Quote:
I was just trying to make sure I understood what you were saying/asking so I don't give you a bum answer. . |
Quote:
|
Quote:
Unfortunately grabbing the page for the chat room won't give us what we want unless we also follow the javascript. That can get sticky. I was just checking and the user list is injected into the room via javascript/ajax so we could try to go grab the url that ajax is calling and see if it would give us a list back. If I get a chance I will poke around and see what there is to see. . |
Bumping up for future reference
|
Hey guys I have a similar problem and I hope that you'll help me one more time ! As you know I am a beginner on programing and I try to develop a cam site using chaturbate APIs , thanks to serettah I figured out of few things and I've made the listing of the models and now I am trying to make the chat room page but here I have problems , just doesn't work , starting from this thread I tried this:
Code:
$users=array(); Sorry for bumping a old thread but since is related to this thread is useless to start a new one ! THANKS |
Code:
$users=array(); Since $users is empty ($users=array() creates an empty array) then you will never hit the echo statement. So, you have to have a username in $users for that to work. . |
Ok I got it so that will not work without a user name in the array ! , so any idea on how to get the iframe of the user that I clicked on the main page ??? Thanks !
|
The url that is being clicked on looks like this: chat.php?/lexxxierose
That is not right. You want something like chat.php?cam=lexxxierose or something along that line. You need a variable name in there to pass in. So if it is chat.php?cam=lexxxierose then in chat.php you would use $_GET['cam'] to get at the name lexxxierose So you would not need the array $users in there. Code:
$cams = new SimpleXMLElement('cams.xml', null, true); . |
Code:
$cams = new SimpleXMLElement('cams.xml', null, true); . |
Wow works great ! You are a real master :thumbsup !
I owe you a lot and not only me the entire community here ! Thank you very much ! |
All times are GMT -7. The time now is 06:57 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc