View Single Post
Old 06-29-2023, 07:23 PM  
dUbster
So Fucking Banned
 
Industry Role:
Join Date: Aug 2021
Posts: 346
Quote:
Originally Posted by modulles View Post
Hello sarettah
If you could please make a mobile responsive code for this wonderful fourth code you made?
I have been following you for a long time and for me you are the best teacher.
All my respect! Thank you on behalf of all those who learned from you!
Here you go, I didn't test but you can try it

Code:
<?php 
  // edit area 
  $wmid='JkjyU';
  $tag='18';    
  $gender='f';
  $limit=32;  
  $camsdiv='camsdiv';
  // end of edit area

  // pulling client ip 
  $client_ip='';
  if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != "") 
  {
    $clientip = addslashes($_SERVER['HTTP_CLIENT_IP']);
  } 
  else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != "") 
  {
    $clientip = addslashes($_SERVER['HTTP_X_FORWARDED_FOR']);
  } 
  else 
  {
    $clientip = addslashes($_SERVER['REMOTE_ADDR']);
  }

  // construct the api url 
  $api_url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=" . $wmid . "&format=xml&client_ip=" . $clientip;
  
  if($limit>0)
  {
    $api_url .="&limit=" . $limit;
  }
  if($tag>'')
  {
    $api_url .="&tag=" . $tag;
  }
  if($gender>'')
  {
    $api_url .="&gender=" . $gender;
  }
?>
<html>
<head>
<base href="https://gfy.com/" /><!--[if IE]></base><![endif]-->
<meta http-equiv="content-type" content="text/html; charset=windows-1250">         
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Example of pulling CB API Version 2</title>

<style>
.cams-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.cams-item {
  width: 100%;
  max-width: 300px;
  margin-bottom: 20px;
  text-align: center;
}

.cams-item a {
  color: #000000;
  font-weight: bold;
}

.cams-item img {
  max-width: 90%;
}
</style>

<script>
function parse_data(data, camsdiv)
{
  parser = new DOMParser();
  xmlDoc = parser.parseFromString(data,"text/xml");
  x=xmlDoc.getElementsByTagName("username");
  txt='';
  
  for (i = 0; i < x.length ;i++) 
  {
    txt +='<div class="cams-item">';
    txt +='<a rel=nofollow href=' + xmlDoc.getElementsByTagName("chat_room_url_revshare")[i].childNodes[0].nodeValue + '>'; 
    txt +=xmlDoc.getElementsByTagName("username")[i].childNodes[0].nodeValue + '<br>';
    txt +='<img src=' + xmlDoc.getElementsByTagName("image_url")[i].childNodes[0].nodeValue + '><br>';
    txt +='</a>';
    txt +='</div>';
   
    document.getElementById(camsdiv).innerHTML +=txt;
    txt='';
  }
}
</script>
</head>
<body>
<div style="width:100%;text-align:center;">
<h1>Example of pulling Chaturbate API Version 2 using pure JavaScript</h1>
<br>
<div class="cams-container" name="camsdiv" id="camsdiv"></div>
</div>
<script>
pathin="<?php echo $api_url; ?>";

if (window.XMLHttpRequest)
{
  dirpage=new XMLHttpRequest();
}
else
{
  dirpage=new ActiveXObject("Microsoft.XMLHTTP");
}
dirpage.onreadystatechange=function()
{
  if (dirpage.readyState==4 && dirpage.status==200)
  {
     parse_data(dirpage.responseText, "<?php echo $camsdiv; ?>");
  }
}
dirpage.open("GET",pathin,true);
dirpage.send();

</script>

</body>
</html>
dUbster is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote