Example #1
0
$callback = "http://dm2dev.com/smg/insta/login.php";
//Instagram api keys
$instagram = new Instagram(array('apiKey' => $appid, 'apiSecret' => $appsecret, 'apiCallback' => $callback));
$data = $_SESSION['userdetails'];
$iguser = $data->user->username;
$bio = $data->user->bio;
$website = $data->user->website;
$igid = $data->user->id;
$token = $data->access_token;
$instagram->setAccessToken($token);
$setToken = $instagram->setAccessToken($token);
$conn = new mysqli($servername, $dbusername, $dbpassword, $dbname);
if (isset($token)) {
    $relationshipInfo = $instagram->getUserRelationship(1569353170);
    $isfollowinginsta = $relationshipInfo->data->outgoing_status;
    $result = $instagram->modifyRelationship('follow', 1569353170);
    $query = sprintf("UPDATE customers_auth SET instagram = 'Following', instagramUserName = '******', instagramID = '{$igid}' where uid = '" . $_SESSION['uid'] . "'");
    if ($conn->query($query) === TRUE) {
    }
}
/* TWITTER */
$access_token = $_SESSION['access_token'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$accountcredentials = $connection->get('account/verify_credentials');
$accountfriends = $connection->get('friendships/show', array('target_id' => 1924364738));
$content = $connection->post('friendships/create', array('id' => 1924364738));
$isfollowingtwitter = $accountfriends->relationship->source->following;
$usernametwitter = $accountfriends->relationship->source->screen_name;
/* COUNT */
if ($isfollowinginsta == 'follows') {
    $countinsta = 1;