Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 11-29-2014, 08:13 PM   #1
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
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
__________________

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
Old 11-29-2014, 08:39 PM   #2
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-29-2014, 10:38 PM   #3
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
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


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
__________________

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
Old 11-30-2014, 01:58 AM   #4
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
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>';
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 06:01 AM   #5
funnytimecpl
Registered User
 
funnytimecpl's Avatar
 
Industry Role:
Join Date: Oct 2014
Posts: 74
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 ?
funnytimecpl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 07:34 AM   #6
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by funnytimecpl View Post
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

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 08:57 AM   #7
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
Old 11-30-2014, 11:01 AM   #8
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
works no problem
It does?

That always surprises the fuck out of me ;p

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 11:07 AM   #9
funnytimecpl
Registered User
 
funnytimecpl's Avatar
 
Industry Role:
Join Date: Oct 2014
Posts: 74
my bad, this looks similar to nomoneyinporn script , and wanted to implement it in my site
funnytimecpl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 11:16 AM   #10
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by funnytimecpl View Post
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 11:22 AM   #11
funnytimecpl
Registered User
 
funnytimecpl's Avatar
 
Industry Role:
Join Date: Oct 2014
Posts: 74
want to show my cam embed and when i'm not online , to show best cam , embed
funnytimecpl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 11:36 AM   #12
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
It does?

That always surprises the fuck out of me ;p

.
i guess u didn?t test the code

__________________

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
Old 11-30-2014, 11:59 AM   #13
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
i guess u didn?t test the code


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 is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 12:11 PM   #14
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by funnytimecpl View Post
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

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 12:13 PM   #15
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
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

ok deleted some messages , yw .
__________________

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
Old 11-30-2014, 01:02 PM   #16
funnytimecpl
Registered User
 
funnytimecpl's Avatar
 
Industry Role:
Join Date: Oct 2014
Posts: 74
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 !

Last edited by funnytimecpl; 11-30-2014 at 01:04 PM.. Reason: apologise added
funnytimecpl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 01:03 PM   #17
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 01:15 PM   #18
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 funnytimecpl View Post

@CPA-Rush sorry for hijacking your thread !
why its not the first time ?

jk
__________________

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
Old 11-30-2014, 01:26 PM   #19
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by funnytimecpl View Post
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 is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 01:38 PM   #20
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by funnytimecpl View Post
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 07:23 PM   #21
funnytimecpl
Registered User
 
funnytimecpl's Avatar
 
Industry Role:
Join Date: Oct 2014
Posts: 74
@ 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
funnytimecpl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 07:44 PM   #22
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by funnytimecpl View Post
@ 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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 11-30-2014, 08:19 PM   #23
funnytimecpl
Registered User
 
funnytimecpl's Avatar
 
Industry Role:
Join Date: Oct 2014
Posts: 74
i'm gonna mail you soon !
funnytimecpl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-01-2014, 09:09 AM   #24
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by sarettah View Post
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");
  }
}

?>
.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-01-2014, 12:27 PM   #25
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
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 ?
__________________

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
Old 12-01-2014, 02:22 PM   #26
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-01-2014, 03:34 PM   #27
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
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 ?
__________________

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
Old 12-01-2014, 05:46 PM   #28
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-01-2014, 06:19 PM   #29
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
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
__________________

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
Old 12-01-2014, 06:35 PM   #30
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-01-2014, 07:01 PM   #31
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
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
__________________

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
Old 12-01-2014, 07:19 PM   #32
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
Quote:
Originally Posted by CPA-Rush View Post
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-13-2014, 08:29 AM   #33
thecatwrites
Confirmed User
 
thecatwrites's Avatar
 
Industry Role:
Join Date: Dec 2014
Posts: 418
Bumping up for future reference
thecatwrites is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2016, 08:31 AM   #34
Andreweb
Confirmed User
 
Andreweb's Avatar
 
Industry Role:
Join Date: Mar 2013
Location: Internet
Posts: 2,422
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 , 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
__________________
Make Money With: Chaturbate
Andreweb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2016, 10:43 AM   #35
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
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.

.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2016, 11:40 AM   #36
Andreweb
Confirmed User
 
Andreweb's Avatar
 
Industry Role:
Join Date: Mar 2013
Location: Internet
Posts: 2,422
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 !
__________________
Make Money With: Chaturbate
Andreweb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2016, 01:25 PM   #37
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
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 is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-10-2016, 06:58 PM   #38
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,509
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.



.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2016, 12:42 AM   #39
Andreweb
Confirmed User
 
Andreweb's Avatar
 
Industry Role:
Join Date: Mar 2013
Location: Internet
Posts: 2,422
Wow works great ! You are a real master !

I owe you a lot and not only me the entire community here ! Thank you very much !
__________________
Make Money With: Chaturbate
Andreweb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
$username, online, echo, add, $online



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.