PHP code example of noxzemart / rt-instagram-sdk-php

1. Go to this page and download the library: Download noxzemart/rt-instagram-sdk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

noxzemart / rt-instagram-sdk-php example snippets



$instagram = new \Instagram\Instagram();

$instagram->login("username", "password");

$instagram->getTimelineFeed($maxId);

$instagram->getUserFeed($userId, $maxId);

$instagram->getMyUserFeed($maxId);

$instagram->getLikedFeed($maxId);

$instagram->getTagFeed($tag, $maxId);

$instagram->getLocationFeed($locationId, $maxId);

$instagram->getUserTagsFeed($userId, $maxId);

$instagram->likeMedia($mediaId);

$instagram->unlikeMedia($mediaId);

$instagram->deleteMedia($mediaId, $mediaType);

$instagram->commentOnMedia($mediaId, $comment);

$instagram->getMediaComments($mediaId, $maxId);

$instagram->deleteCommentsFromMedia($mediaId, $commentIds);

$instagram->getUserInfo($userId);

$instagram->getUserFollowers($userId, $maxId);

$instagram->getUserFollowing($userId, $maxId);

$instagram->getUserMap($userId);

$instagram->getMediaInfo($mediaId);

$instagram->getCurrentUserAccount();

$instagram->editUserProfile($firstname, $email, $phoneNumber, $gender, $biography, $externalUrl);

$instagram->setAccountPublic();

$instagram->setAccountPrivate();

$instagram->showFriendship($userId);

$instagram->followUser($userId);

$instagram->unfollowUser($userId);

$instagram->blockUser($userId);

$instagram->unblockUser($userId);

$instagram->searchTags($query);

$instagram->searchUsers($query);

$instagram->searchFacebookPlaces($query);

$instagram->searchFacebookPlacesByLocation($latitude, $longitude);

$instagram->changeProfilePicture($path);

$instagram->removeProfilePicture();

$instagram->postPhoto($path, $caption);

$instagram->editMedia($mediaId, $caption);

$instagram->getUserByUsername($username);

$instagram->logout();

//Login
$instagram->login("username", "password");

//Serialize the Session into a JSON string
$savedSession = $instagram->saveSession();

//Store $savedSession in Database, or Cookie etc

//Load $savedSession from Database or Cookie etc
$savedSession = ...;

//Init from Saved Session
$instagram->initFromSavedSession($savedSession);

//Session is Restored, do something!
$instagram-> ...;

//Get TimelineFeed
$timelineFeed = $instagram->getTimelineFeed();

//This will be null if there are no more pages.
$nextMaxId = $timelineFeed->getNextMaxId();

//We have another page of Items
if($nextMaxId != null){
	//Get the next page.
	$timelineFeed = $instagram->getTimelineFeed($nextMaxId);
}

$instagram->setProxy("127.0.0.1:8888");

$instagram->setProxy("127.0.0.1:8888", "proxyUsername", "proxyPassword");

$instagram->setVerifyPeer(false);