API Tinder to see pictures and if it is a match or not
<?php
$url_login = 'https://api.gotinder.com/auth';
$data_login = array(
'facebook_token'=> 'XXXXXXXXXXXXXXXXXXXXXXX' ,
'facebook_id'=> 'YYYYYYYYYY');
$json_login= json_encode($data_login);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url_login);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_login);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'Content-Type: application/json',
'User-Agent: Tinder/4.1.4 (iPhone; iOS 8.1.3; Scale/2.00)'
));
//execute post
$result_login = curl_exec($ch);
//Status
$status = curl_getinfo ($ch);
//close connection
curl_close($ch);
$r_login = json_decode($result_login);
if($status['http_code'] == 200){
$url_recommendations = 'https://api.gotinder.com/user/recs';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url_recommendations);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_login);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'Content-Type: application/json',
'User-Agent: Tinder/4.1.4 (iPhone; iOS 8.1.3; Scale/2.00)',
'X-Auth-Token: '.$r_login->token.''
));
$result_recommendations = curl_exec($ch);
$r_recc = json_decode($result_recommendations, true);
if($r_recc['status'] == 200) {
$recommendations = $r_recc['results'];
foreach ($recommendations as $key => $user) {
echo '<div style=" margin-bottom: 25px;position: relative;">';
echo 'Name: '.$user['name'].' <br>';
//Photos
foreach ($user['photos'] as $key => $photo) {
echo '<img src= "'.$photo['processedFiles'][0] ['url'].'" />';
}
echo '<div style="float: none; clear:both; with: 100%"> </div>';
$url_like = 'https://api.gotinder.com/like/'.$user['_id'];
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url_like);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_login);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'Content-Type: application/json',
'User-Agent: Tinder/4.1.4 (iPhone; iOS 8.1.3; Scale/2.00)',
'X-Auth-Token: '.$r_login->token.''
));
//execute post
$result_like = curl_exec($ch);
$r_like = json_decode($result_like);
if($r_like->match)
echo '<h1 style=" position: absolute; top: 180px; left: 585px; border-radius: 7px; border: 2px solid #1A9E11; padding: 35px; background: #fff; font-size: 75px; transform: rotate(90deg); "> :) </h1>';
else
echo '<h1 style=" position: absolute; top: 180px; left: 585px; border-radius: 7px; border: 2px solid #1A9E11; padding: 35px; background: #fff; font-size: 75px; transform: rotate(90deg); "> :( </h1>';
echo '<h1 style=" position: absolute;top: 18px;right: 60px;border-radius: 147px;border: 2px solid #3F51B5; padding: 35px; background: #fff;font-size: 17px;"> '.$r_like->likes_remaining.' </h1>';
echo '</div>';
}
curl_close($ch);
}
else
echo 'Error getting recommendations';
}
else
echo 'Error Login';
?>