View Single Post
Old 07-12-2021, 11:43 AM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Just for clarity, GFY inserts the base HREF statement in there, it is not part of the code.

<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 Whalehunter JSON API</title>

<style>
body{text-align:center;}
#camsdiv{width:100%;text-align:center;}
.cam_div{position:relative;float:left;width:100%;m argin-bottom:10px;padding:right:10px;text-align:center;}
a{color:#000000;font-weight:bold;text-decoration:none;}
img{max-width:90%;margin-bottom:15px;}

@media only screen and (min-width: 600px)
{
.cam_div{width:25%;}
}

</style>

<body>
<div style="width:100%;text-align:center;">
<h1>Example of pulling Whalehunter Cash Old API using PHP call to API</h1>
<br>
<div name="camsdiv" id="camsdiv" style="margin-left:15px;">

<?php

// change error reporting ot 0 to suppress errors, change tp E_ALL to see all errors during debugging
error_reporting(E_ALL);

// Webmaster edit area - change these variables as needed

// set this to the site you are pulling for, it becomes the referer in the request
$mysite='http://mysite.com';

// variables - take these from affiliate code url in your api dashboard
// make sure to change these out Important, they are case sensitive.
$affiliate='Affiliate_Code_Goes_Here';
$appid='API_ID_Goes_here';
$appkey='APP_KEY_Goes_here';
//

// OLD Whale hunter API optional parameters
// online: 0 - all models, 1 - only online models
// videos: 1 - only models with pulic videos
// store: 1 - only models with store
// priceMin
// priceMax
// ageMin
// ageMax
// keyword (ie: &keywords=blonde models
// tags (ie: &tags=anal,blondes
// page (page number in return set, use with limit ie: if yuou are pulling 30 cams per page and want page 2 you would say &page=2&limit=30)
// limit (number of cams to pull to pull 30 cams &limit=30)
// ip (some models are hidden by ip so this should be sent If not sent skyprivate will use the ip coming in)

$online='1';
$videos='0';
$store='0';
$pricemin='';
$pricemax='';
$agemin='';
$agemax='';
$keyword='';
$tags='';
$limit='32';
$pageno='';
// ip has to have something in it or api fails
$ip=addslashes($_SERVER['REMOTE_ADDR']);

// end of optional parameters

// cam template
// to include a variable use [**variable name**] as the template tag
$cam_template ='<div class=cam_div>';
$cam_template .='<a rel=nofollow href=[**tracking_url**]>';
$cam_template .='[**name**]<br>';
$cam_template .='<img style="max-width:90%;margin-bottom:15px;" src=[**img**]><br>';
$cam_template .='Age: [**age**] ';
$cam_template .='[**top3tags**]<br>';
$cam_template .='</a>';
$cam_template .='</div>';
// end of cam template

// end of webmaster edit area

// replace list
$replace_it=array();
$replace_it[]='[**age**]';
$replace_it[]='[**country**]';
$replace_it[]='[**name**]';
$replace_it[]='[**show_price**]';
$replace_it[]='[**score**]';
$replace_it[]='[**min_sum**]';
$replace_it[]='[**paypermin**]';
$replace_it[]='[**category**]';
$replace_it[]='[**top3tags**]';
$replace_it[]='[**video_link**]';
$replace_it[]='[**img**]';
$replace_it[]='[**tracking_url**]';

// Fields coming into the return - From the whalehunter documentation.

// ● {
// ● "state": "success",
// ● "results": [1000] - default number; total models per page in this feed; you can change the limit from the feed`s link; if you go above [50] then the feed will include the offline models also
// ● {
// ● "id": "...", - you can ignore this one
// ● "idp": "...", - you can ignore this one
// ● "age": "...", - model`s age
// ● "country": "...", - model`s country
// ● "name": "...", - model`s public name
// ● "show_price": "...", - if model`s price per min is public or not
// ● "show_skype": "...", - if model`s Skype ID is public or not
// ● "score": "...", - model`s total score from members reviews
// ● "min_sum": "...", - funds that a member must have in his account to be able to contact her
// ● "idImage": "...", - you can ignore this one
// ● "imgExt": "...", - you can ignore this one
// ● "verified": "...", - if the model is verified by Skyprivate or not
// ● "paypermin": "...", - model`s price per minute
// ● "dstatus": "...", - you can ignore this one
// ● "category": "...", - model`s category
// ● "top3tags": "...", - top 3 tags of the model
// ● "tags": [ "...", "...",], - tags set by the model to best identify what she/he does
// ● "video": {
// ● "link": "...", - direct link to model`s preview video, the one that the model has in the cover of the profile page
// ● "id": "..." },
// ● "avatar": {
// ● "filename": "...", - model`s avatar file name
// ● "sizes":
// ● "160x153": "...", - model`s avatar photo at the dimension specified here
// ● "409x230": "..." - model`s avatar photo at the dimension specified here
// ● "path": "...",
// ● "link": "..." }, - model`s profile photo at 160x153px
// ● "modelcentro": { ... }, - you can ignore this one
// ● "publicId": "...", - model`s public ID that is included in the link to the profile page
// ● "tracking_url": "...", - your affiliate link to the model`s profile page
// ● "isLive": "...", - model`s real time live status
// ● "images": {
// ● "default": [ "...", "...", "..." ]} - model`s first 3 photos at full size
// ● }


// construct chatfeed link
$chatfeedlink='https://apps.skyprivate.com/profiles/list.json?appid=' . $appid . '&appkey=' . $appkey . '&affiliate=' . $affiliate;

if(!empty($online))
{
$chatfeedlink .='&online=' . $online;
}
if(!empty($videos))
{
$chatfeedlink .='&videos=' . $videos;
}
if(!empty($store))
{
$chatfeedlink .='&store=' . $store;
}
if(!empty($pricemin))
{
$chatfeedlink .='&pricemin=' . $pricemin;
}
if(!empty($pricemax))
{
$chatfeedlink .='&pricemax=' . $pricemax;
}
if(!empty($agemin))
{
$chatfeedlink .='&agemin=' . $agemin;
}
if(!empty($agemax))
{
$chatfeedlink .='&agemax=' . $agemax;
}
if(!empty($keyword))
{
$chatfeedlink .='&keyword=' . $keyword;
}
if(!empty($tags))
{
$chatfeedlink .='&tags=' . $tags;
}
if(!empty($pageno))
{
$chatfeedlink .='&page=' . $pageno;
}
if(!empty($limit))
{
$chatfeedlink .='&limit=' . $limit;
}
$chatfeedlink .='&ip=' . $ip;

// for debugging if you want to see the link you are calling
//echo "chatfeedlink=" . $chatfeedlink . "<br>\n";

// Retrieve api
$api_return=get_api($chatfeedlink, $mysite);

// for debugging to see the return from the api
//echo "return=" . $api_return . "<br>\n";
//flush();

$chkit=json_decode($api_return, true);
unset($api_return);

if(trim(strtolower($chkit['state']))=='success')
{
for($i=0;$i<count($chkit['results']);$i++)
{
if(substr(trim($chkit['results'][$i]['video']['link']), intval(strlen(trim($chkit['results'][$i]['video']['link']))-4),4)=='.mp4')
{
$replace_with=array();
$replace_with[]=$chkit['results'][$i]['age'];
$replace_with[]=$chkit['results'][$i]['country'];
$replace_with[]=$chkit['results'][$i]['name'];
$replace_with[]=$chkit['results'][$i]['show_price'];
$replace_with[]=$chkit['results'][$i]['score'];
$replace_with[]=$chkit['results'][$i]['min_sum'];
$replace_with[]=$chkit['results'][$i]['paypermin'];
$replace_with[]=$chkit['results'][$i]['category'];
$replace_with[]=str_replace(",",", ",$chkit['results'][$i]['top3tags']);
$replace_with[]=$chkit['results'][$i]['video']['link'];
$replace_with[]=$chkit['results'][$i]['avatar']['sizes']['409x230'];
$replace_with[]=$chkit['results'][$i]['tracking_url'];

echo str_replace($replace_it, $replace_with, $cam_template);
flush();
}
}
}

?>

</div>
</div>
</body>
</html>

<?php

// function to retrieve the api
function get_api($urlin,$referin)
{
$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);
if(!empty($referin))
{
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;
}
?>

.
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote