View Single Post
Old 06-07-2017, 11:00 AM  
lokee81
Registered User
 
Industry Role:
Join Date: Jun 2016
Posts: 17
Quote:
Originally Posted by sarettah View Post
You use a program to pull a feed.

So in PHP for example it would be something like:

// First get the feed
$my_json_feed = file_get_contents('chaturbate feed url');

// Second decode the json data
$my_json_data = json_decode($my_json_feed);

// Third do something with the data
var_dump($my_json_data);


You can call the program from cron so it launches periodically.

You could use curl in the program to grab the feed too but it is more than a one line operation.

This is the PHP curl code I use to grab urls:

function get_page($urlin,$referin)
{
echo "urlin=" . $urlin . "<br>\n";
echo "referin=" . $referin . "<br>\n";

$returnit="";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8');
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_REFERER, $referin);
curl_setopt($ch, CURLOPT_URL, $urlin);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result['EXE'] = curl_exec($ch);
$result['ERR'] = curl_error($ch);
curl_close($ch);
if($result['ERR']>"")
{
$returnit="error - " . $result['ERR'];
}
else
{
$returnit=$result['EXE'];
}
return $returnit;
}

.
Hm, ok . Huff. I dont know much about PHP yet. I have mainly focused on Javascript in my learning so far.

I tough that this : (http)/chaturbate(dot)com/affiliates/api/onlinerooms/?format=json&wm=C9m5N would be saved as a JSON file ? I see that it does not have the .json at the end there, but it must be saved as this somewhere ?

The best guess for me would be to pull it then using node.js ?

or would it be a direct link to a JSON file somewhere on Chaturbate? Is there any way to save that feed as a JSON ?

My plan was to save it every 2-5 min on my server and then just access the JSON file on my server and pharse out what I wanted to display using javascript
__________________
camporn.xxx
lokee81 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote