GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   script to show if specific room is online , i need to add feature (https://gfy.com/showthread.php?t=1155742)

CPA-Rush 11-29-2014 08:13 PM

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

sarettah 11-29-2014 08:39 PM

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.

.

CPA-Rush 11-29-2014 10:38 PM

Quote:

Originally Posted by sarettah (Post 20306625)
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.

.

image_url

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

sarettah 11-30-2014 01:58 AM

Quote:

Originally Posted by CPA-Rush (Post 20306678)
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>';


funnytimecpl 11-30-2014 06:01 AM

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 ?

sarettah 11-30-2014 07:34 AM

Quote:

Originally Posted by funnytimecpl (Post 20306816)
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 ?

Depend on exactly ehat you mean by show your cam when online but using the code from above. You could make yourself the only user in the array and then in the "if(!online..." you could put up the best converting tour link:

Code:

$users_to_show=array("myusername");

$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"> Info for best converting tour here.....;

That is probably not what you really want though. I am thinking you want to iframe your room or the best converting room. But I have answered what you have asked and will wait to see if that was what you really want ;p

.

CPA-Rush 11-30-2014 08:57 AM

Quote:

Originally Posted by sarettah (Post 20306728)
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!
http://smileys.on-my-web.com/reposit...ct/cup-006.gif

sarettah 11-30-2014 11:01 AM

Quote:

Originally Posted by CPA-Rush (Post 20306988)
works no problem

It does?

That always surprises the fuck out of me ;p

.

funnytimecpl 11-30-2014 11:07 AM

my bad, this looks similar to nomoneyinporn script , and wanted to implement it in my site:)

sarettah 11-30-2014 11:16 AM

Quote:

Originally Posted by funnytimecpl (Post 20307077)
my bad, this looks similar to nomoneyinporn script , and wanted to implement it in my site:)

What exactly do you want to implement? I know you said show your room or the best converting tour. But what exactly do you want to show? A link to your room versus the tour or the actual room or ???

Easy enough to do it in just about any version of a chaturbate script.

.

funnytimecpl 11-30-2014 11:22 AM

want to show my cam embed and when i'm not online , to show best cam , embed

CPA-Rush 11-30-2014 11:36 AM

Quote:

Originally Posted by sarettah (Post 20307074)
It does?

That always surprises the fuck out of me ;p

.

i guess u didn?t test the code

:thumbsup

sarettah 11-30-2014 11:59 AM

Quote:

Originally Posted by CPA-Rush (Post 20307096)
i guess u didn?t test the code

:thumbsup


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.

.

sarettah 11-30-2014 12:11 PM

Quote:

Originally Posted by funnytimecpl (Post 20307085)
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 :thumbsup

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:

.

CPA-Rush 11-30-2014 12:13 PM

Quote:

Originally Posted by sarettah (Post 20307109)
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.

.

sure :thumbsup

ok deleted some messages , yw .

funnytimecpl 11-30-2014 01:02 PM

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


        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        // Header

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////       

       

        function tpl_header($cmd, $title, $des, $kws) {

       

                $link = $_GET["arg1"];

               

                echo '

               

                <!DOCTYPE html>

               

                <html lang="en">

               

                        <head>

                       

                                <title>' . $title . '</title>

                               

                                <meta charset="utf-8" />

                                <meta name="description" content="' . $des . '" />

                                <meta name="keywords" content="' . $kws . '" />
       
                                <meta name="rating" content="mature" />
                       
                                <meta name="RATING" content="RTA-5042-1996-1400-1577-RTA" />

                                <meta name="prVerify" content="f752666eea61d62bfae88c73088fb001" />
               
                                <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,600,700" rel="stylesheet" type="text/css">


                                <!--[if lte IE 8]><script src="' . BASEHREF . 'css/ie/html5shiv.js"></script><![endif]-->


                                <script src="' . BASEHREF . 'js/jquery.min.js"></script>


                                <script src="' . BASEHREF . 'js/skel.min.js"></script>

                                <script src="' . BASEHREF . 'js/jquery.isotope.js"></script>
                                <script src="' . BASEHREF . 'js/skel-panels.min.js"></script>

                                <script src="' . BASEHREF . 'js/init.js"></script>

                                <script src="' . BASEHREF . 'js/analitycs.js"></script>




                                <noscript>

                                        <link rel="stylesheet" href="' . BASEHREF . 'css/skel-noscript.css" />

                                        <link rel="stylesheet" href="' . BASEHREF . 'css/style.css" />
                                       

                                </noscript>

                                <!--[if lte IE 8]><link rel="stylesheet" href="' . BASEHREF . 'css/ie/v8.css" /><![endif]-->

                                <!--[if lte IE 9]><link rel="stylesheet" href="' . BASEHREF . 'css/ie/v9.css" /><![endif]-->       
                               


                        </head>

                       

                        <body>
               
                                <div id="header" class="skel-panels-fixed">
                                       
                                                       
                                                <!-- Logo -->

                                                        <a href="' . BASEHREF . '" id="logo">' . LOGO . '</a>
                                       

                                                <nav id="nav">

                                                        <ul>
                                                                       
                                                               
                                                                <li><a href="' . BASEHREF . 'cams/female" class="' . ( ($link == "female") ? "active"  : "") . '">BABES</a></li>
                                                               
                                                                <li><a href="' . BASEHREF . 'cams/male" class="' . ( ($link == "male") ? "active"  : "") . '">MALES</a></li>

                                                                <li><a href="' . BASEHREF . 'cams/couple" class="' . ( ($link == "couple") ? "active"  : "") . '">COUPLES</a></li>

                                                                <li><a href="' . BASEHREF . 'cams/shemale" class="' . ( ($link == "shemale") ? "active"  : "") . '">SHEMALES</a></li>

                                                                <li><a href="http://' . CBWL . '/affiliates/in/3Mc9/' . AFFID . '/?track=' . TRACK . '" class="button">Get your <strong>FREE</strong> account!</a></li>

                                                                <!--

                                                                        <li><a href="http://' . CBWL . '/affiliates/in/NwNd/' . AFFID . '/?track=' . TRACK . '">Broadcast Your Cam!</a></li>

                                                                        <li><a href="http://' . CBWL . '/affiliates/in/07kX/' . AFFID . '/?track=' . TRACK . '">Affiliate Program</a></li>

                                                                -->

                                                        </ul>

                                                </nav>

                                               

                                               

                                               

                                       

                                </div>

                       

                        <!-- Main -->

                                <div id="main">
                                        <div class="description">
<center> here i want the embed cam ... but only on first page ...  @sarettah - gfy.com</center>

<center><div class="pr-widget" id="pr-94zi" style="height:156px;width:1000px;"></div></center>
               
                        <h1 style="font-size:24px;font-weight:bold;color:#F47321;margin:0 50px;">YEAH! Perv this is 100% free !</h1>
                        <span style="font-size:13px;font-weight:600;color:#0C6A93;text-indent:20px;text-align:justify;margin:0 30px;">Hi ! I&#39;m Munira you know me as <a href="http://fttube.com/blog/me-online/">FunnyTimeCPL</a> , you can check this beautiful girls and boys , watch them LIVE for FREE!</span>

                                        </div>
                                        <div class="pr-slider-widget" id="pr-92pz"></div>

                                        <div class="container">
               

                ';

       

        }

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        // Footer

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////       

       

        function tpl_footer() {

       

                echo '

               

                                        </div>
<br>
                               
<p style="text-align: center;"><a href="http://chaturbate.com/affiliates/in/hr8m/6ugdP/?track=blogfooter"><img class="aligncenter" src="https://ssl-ccstatic.highwebmedia.com/affiliates/banners/724x90d.jpg" alt="" width="724" height="90" /></a>


                                </div>


                        <!-- Footer -->

                                <div id="footer">

                                        <div class="container">
                        <p>
                                </span><a href="http://' . CBWL . '/affiliates/in/3Mc9/' . AFFID . '/?track=' . TRACK . '"><span style="color:#fff0f5;">Get your <strong>FREE</strong> account!</span></a><span style="color:#fff0f5;"> &nbsp;| </span><a href="http://' . CBWL . '/affiliates/in/NwNd/' . AFFID . '/?track=' . TRACK . '"><span style="color:#fff0f5;">Broadcast Your Cam!</span></a><span style="color:#fff0f5;"> &nbsp;| </span><a href="http://' . CBWL . '/affiliates/in/07kX/' . AFFID . '/?track=' . TRACK . '"><span style="color:#fff0f5;">Affiliate Program</span></a></p>
                       
                        <p>
                                <span style="color:#fff0f5;">&copy; ' . SITENAME . ',  All Rights Reserved. Powered by </span><a href="http://' . CBWL . '/affiliates/in/hr8m/' . AFFID . '/?track=' . TRACK . '" target="_blank"><span style="color:#fff0f5;">Chaturbate</span></a></p>
                </div>
                                       
                                        <span><img src="http://fttube.com/images/labeled.gif"></span>

                                </div>

                       

                        </body>

                       

                </html>

               

                ';

       

        }



        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        // Homepage

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////               

       

        function tpl_home() {

                       

                get_cams ( AFFID, TRACK, $gender='', 28 );

                               

        }

       

        function tpl_cams() {

       

                $gender = $_GET['arg1'];

       

                switch ( $gender ) {

                       

                        case 'female':

                                $gender = 'f';

                                break;

                        case 'male':

                                $gender = 'm';

                                break;

                        case 'couple':

                                $gender = 'c';

                                break;

                        case 'shemale':

                                $gender = 's';

                                break;

                        default:

                                $gender = '';



                }

               

                get_cams ( AFFID, TRACK, $gender, 28 );

               

        }

       

        function tpl_view_cams() {

       

               

                solo_cams( AFFID, TRACK, $_GET['arg1'] );

               

       

        }



?>





@CPA-Rush sorry for hijacking your thread !

sarettah 11-30-2014 01:03 PM

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
$user_to_find="myusername";
$online_file="online.txt";
$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=="myusername")
{
  $outfile=fopen("online.txt");
  =fwrite($outfile,'1');
  =fclose($outfile);
  $cams=null;
}
else
{
  if(is_file("online.txt"))
  {
    unlink("online.txt");
  }
}
?>

Now, to test that from a browser you will probably have to change permissions so the script can write the file. So 777 the folder, test. Once the file is being written and deleted as expected put the permissions back to whatever they were when you started.

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
$iframe_code="My_iframe_code";
$top_room_iframe_code="top_room_iframe_code_goes_here";
$online_file="online/online.txt";
if(is_file($on_line_file))
{
  echo $iframe_code;
}
else
{
  echo $top_room_iframe_code;
}
?>

The result should be that your embedded page should load a whole lot quicker then it did using the earlier code.

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.

.

CPA-Rush 11-30-2014 01:15 PM

Quote:

Originally Posted by funnytimecpl (Post 20307171)

@CPA-Rush sorry for hijacking your thread !

why its not the first time ?

jk :upsidedow

sarettah 11-30-2014 01:26 PM

Quote:

Originally Posted by funnytimecpl (Post 20307171)
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

@CPA-Rush sorry for hijacking your thread !

I had not seen this before I posted the other stuff I did. Sorry about that.

Will look when I get a chance.

.

sarettah 11-30-2014 01:38 PM

Quote:

Originally Posted by funnytimecpl (Post 20307171)
it works on a blank page , but cant manage to make it only on first page :(

I just took a quick look at what you posted and the page...

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:


function tpl_home()
{
    The code to embed your cam....
    get_cams ( AFFID, TRACK, $gender='', 28 );
}

See what that does for you.


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.

.

funnytimecpl 11-30-2014 07:23 PM

@ 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

sarettah 11-30-2014 07:44 PM

Quote:

Originally Posted by funnytimecpl (Post 20307419)
@ 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

yw.

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.

.

funnytimecpl 11-30-2014 08:19 PM

i'm gonna mail you soon !

sarettah 12-01-2014 09:09 AM

Quote:

Originally Posted by sarettah (Post 20307172)
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
$user_to_find="myusername";
$online_file="online.txt";
$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=="myusername")
{
  $outfile=fopen("online.txt");
  =fwrite($outfile,'1');
  =fclose($outfile);
  $cams=null;
}
else
{
  if(is_file("online.txt"))
  {
    unlink("online.txt");
  }
}
?>

Now, to test that from a browser you will probably have to change permissions so the script can write the file. So 777 the folder, test. Once the file is being written and deleted as expected put the permissions back to whatever they were when you started.

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
$iframe_code="My_iframe_code";
$top_room_iframe_code="top_room_iframe_code_goes_here";
$online_file="online/online.txt";
if(is_file($on_line_file))
{
  echo $iframe_code;
}
else
{
  echo $top_room_iframe_code;
}
?>

The result should be that your embedded page should load a whole lot quicker then it did using the earlier code.

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.

.


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
$user_to_find="myusername";
$online_file="online.txt";
$cams = new SimpleXMLElement('http://chaturbate.com/affiliates/api/onlinerooms/?format=xml&wm=AFFILIATELINK', null, true);
$online = 0;
foreach ($cams->xpath('//username') as $username) {
if($username=="myusername")
{
  $outfile=fopen($online_file, 'w'); // added the 'w' to make this writeable.  Changed to use file varname
  fwrite($outfile,'1');  // removed the '=' at the beginning.  different language
  fclose($outfile);  // removed the '=' at the beginning.  different language
  $cams=null;
  $online=1;
}
}
// moved this outside the for loop so we do not overwrite the file every time
if(!$online)
{
  if(is_file($online_file))
  {
    unlink("online.txt");
  }
}

?>

.

CPA-Rush 12-01-2014 12:27 PM

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 ? :)

sarettah 12-01-2014 02:22 PM

Quote:

Originally Posted by CPA-Rush (Post 20308098)
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 ? :)

I don't think you can get at a list of who is watching the room through the feed. The information is just not there.

You could scrape a page and pick up that information perhaps.

.

CPA-Rush 12-01-2014 03:34 PM

Quote:

Originally Posted by sarettah (Post 20308245)
I don't think you can get at a list of who is watching the room through the feed. The information is just not there.

You could scrape a page and pick up that information perhaps.

.

that correct , we can see only text/list of names in feed but no much info .

curious would this be easier if it was html page ?

sarettah 12-01-2014 05:46 PM

Quote:

Originally Posted by CPA-Rush (Post 20308325)
that correct , we can see only text/list of names in feed but no much info .

curious would this be easier if it was html page ?

You say the text/list of names in the feed?? You are confusing me there. The feed lists the users that are on cam NOT the users watching the cam. If you know different then please show me and correct me.

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.

.

CPA-Rush 12-01-2014 06:19 PM

Quote:

Originally Posted by sarettah (Post 20308472)
You say the text/list of names in the feed?? You are confusing me there. The feed lists the users that are on cam NOT the users watching the cam. If you know different then please show me and correct me.

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.

.

ok sorry regularly i don?t look for every word in the dictionary before saying something . but i guess u got it .

this is more clear now :)

sarettah 12-01-2014 06:35 PM

Quote:

Originally Posted by CPA-Rush (Post 20308505)
ok sorry regularly i don’t look for every word in the dictionary before saying something . but i guess u got it .

Hmm, sorry if I sounded harsh,. I did not mean to. There is always a smilie at the end of my posts even if I forget to put it there.

I was just trying to make sure I understood what you were saying/asking so I don't give you a bum answer.

.

CPA-Rush 12-01-2014 07:01 PM

Quote:

Originally Posted by sarettah (Post 20308523)
Hmm, sorry if I sounded harsh,. I did not mean to. There is always a smilie at the end of my posts even if I forget to put it there.

I was just trying to make sure I understood what you were saying/asking so I don't give you a bum answer.

.

np i had to say URL :)

sarettah 12-01-2014 07:19 PM

Quote:

Originally Posted by CPA-Rush (Post 20308535)
np i had to say URL :)

Ok, now I understand what you were asking. My bad for not seeing you had put the url of the chatroom in there.

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.

.

thecatwrites 12-13-2014 08:29 AM

Bumping up for future reference

Andreweb 02-10-2016 08:31 AM

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();

$cams = new SimpleXMLElement('cams.xml', null, true);


foreach ($cams as $user)
{
  if(in_array(strtolower($user->username),$users))
  {
    echo $user->iframe_embed_revshare;
 
  }
}

The only thing I get is a blank page :1orglaugh , I tried many things but I just can't make it work ! I hope that you'll help me one more time ! By the way a sample page of my project is here : http://privatecams.webcam !

Sorry for bumping a old thread but since is related to this thread is useless to start a new one ! THANKS

sarettah 02-10-2016 10:43 AM

Code:

$users=array();

$cams = new SimpleXMLElement('cams.xml', null, true);


foreach ($cams as $user)
{
  if(in_array(strtolower($user->username),$users))
  {
    echo $user->iframe_embed_revshare;
 
  }
}

That is only going to hit the echo statement if the user name is in the array $users.

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.

.

Andreweb 02-10-2016 11:40 AM

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 !

sarettah 02-10-2016 01:25 PM

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);

foreach ($cams as $user)
{
  if(strtolower($user->username)==$_GET['cam'])
  {
    echo $user->iframe_embed_revshare;
  }
}

That is a simple version of what you need to do.


.

sarettah 02-10-2016 06:58 PM

Code:

$cams = new SimpleXMLElement('cams.xml', null, true);

if(isset($_GET['cam']))
{
  foreach ($cams as $user)
  {
    if(strtolower($user->username)==strtolower($_GET['cam']))
    {
      echo $user->iframe_embed_revshare;
      break;
    }
  }
}

A couple of little changes to make it a little better implementation. Still inefficient as hell to have to go through the whole xml file each time you want something. imho of course.



.

Andreweb 02-11-2016 12:42 AM

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