PHP Class Instagram\Instagram

Show file Open project: liamcottle/instagram-sdk-php Class Usage Examples

Public Methods

Method Description
__construct ( )
blockUser ( string | User $userId ) : BlockFriendshipResponse Block User
changeProfilePicture ( string $path ) : ChangeProfilePictureAccountResponse Change Profile Picture
commentOnMedia ( string | FeedItem $mediaId, string $comment ) : CommentMediaResponse Comment on Media
deleteCommentsFromMedia ( string | FeedItem $mediaId, array $commentIds ) : API\Response\BulkDeleteCommentsMediaResponse Delete Media Comments
deleteMedia ( string | FeedItem $mediaId, string $mediaType ) : DeleteMediaResponse Delete Media
editMedia ( string | FeedItem $mediaId, string $caption = null ) : EditMediaResponse Edit Media
editUserProfile ( string $firstname = null, string $email = null, string $phoneNumber = null, integer $gender = null, string $biography = null, string $externalUrl = null ) : EditProfileAccountResponse Edit User Profile
followUser ( string | User $userId ) : CreateFriendshipResponse Follow User
generateDeviceId ( $seed ) : string
getCSRFToken ( ) : string
getCookies ( ) : array
getCurrentUserAccount ( ) : CurrentUserAccountResponse Get Current User Account
getDeviceId ( ) : string
getGUID ( ) : string
getGoogleAdId ( ) : string
getLikedFeed ( string $maxId = null ) : LikedFeedResponse Fetch Liked Feed
getLocationFeed ( string | Location $locationId, string $maxId = null ) : LocationFeedResponse Fetch Location Feed
getLoggedInUser ( ) : User
getMediaComments ( string | FeedItem $mediaId, string $maxId ) : CommentsMediaResponse Get Media Comments
getMediaInfo ( string | FeedItem $mediaId ) : InfoMediaResponse Get Media Info
getMyUserFeed ( string $maxId = null ) : UserFeedResponse Fetch My User Feed
getPhoneId ( ) : string
getProxy ( ) : string Get the HTTP Proxy to be used for Instagram API Requests
getProxyCredentials ( ) : string Get the HTTP Proxy Credentials to be used for Instagram API Requests
getRankToken ( ) : string
getTagFeed ( string $tag, string $maxId = null ) : TagFeedResponse Fetch Tag Feed
getTimelineFeed ( string $maxId = null ) : TimelineFeedResponse Fetch Timeline Feed
getUUID ( ) : string
getUserByUsername ( string $username ) : User Get User by Username
getUserFeed ( string | User $userId, string $maxId = null ) : UserFeedResponse Fetch User Feed
getUserFollowers ( string | User $userId, string $maxId ) : FollowersFriendshipResponse Get User Followers
getUserFollowing ( string | User $userId, string $maxId ) : FollowingFriendshipResponse Get User Following
getUserInfo ( string | User $userId ) : InfoUserResponse Get User Info
getUserMap ( string | User $userId ) : UserMapResponse Get GeoMedia from Map of User
getUserRankToken ( ) : string
getUserTagsFeed ( string | User $userId, string $maxId = null ) : UserTagsFeedResponse Fetch User Tags Feed
initFromSavedSession ( $session ) Initialize the Instagram instance from a previously saved session
isLoggedIn ( ) : boolean
likeMedia ( string | FeedItem $mediaId ) : API\Response\LikeMediaResponse Like Media
login ( $username, $password ) : LoginResponse Login to Instagram with Credentials
logout ( ) : API\Response\LogoutResponse Logout
postPhoto ( string $path, string $caption = null ) : ConfigureMediaResponse Post Photo to Timeline
removeProfilePicture ( ) : ChangeProfilePictureAccountResponse Remove Profile Picture
saveSession ( ) : string Save the current Instagram session to a JSON string
searchFacebookPlaces ( string $query ) : PlacesFacebookSearchResponse Search Facebook Places
searchFacebookPlacesByLocation ( string $latitude, string $longitude ) : PlacesFacebookSearchResponse Search Facebook Places by Location
searchTags ( string $query ) : SearchTagsResponse Search Tags
searchUsers ( string $query ) : SearchUsersResponse Search Users
setAccountPrivate ( ) : SetPrivateAccountResponse Set Account as Private
setAccountPublic ( ) : SetPublicAccountResponse Set Account as Public
setCookies ( array $cookies )
setCsrfToken ( string $csrfToken )
setDeviceId ( string $deviceId )
setGoogleAdId ( string $googleAdId )
setGuid ( string $guid )
setLoggedInUser ( User $loggedInUser )
setPhoneId ( string $phoneId )
setProxy ( $proxy, string $username = null, string $password = null ) Set the HTTP Proxy to be used for Instagram API Requests
setRankToken ( string $rankToken )
setUuid ( string $uuid )
setVerifyPeer ( $verifyPeer ) Enable/Disable SSL Verification of Peer
setupAsNewDevice ( ) Setup this instance with a fresh GUID, UUID and Phone ID.
shouldVerifyPeer ( ) : string SSL Verification of Peer
showFriendship ( string | User $userId ) : ShowFriendshipResponse Show Friendship between User
unblockUser ( string | User $userId ) : UnblockFriendshipResponse Unblock User
unfollowUser ( string | User $userId ) : DestroyFriendshipResponse Unfollow User
unlikeMedia ( string | FeedItem $mediaId ) : API\Response\UnlikeMediaResponse Unlike Media

Method Details

__construct() public method

public __construct ( )

blockUser() public method

Block User
public blockUser ( string | User $userId ) : BlockFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to Block
return Instagram\API\Response\BlockFriendshipResponse

changeProfilePicture() public method

Change Profile Picture
public changeProfilePicture ( string $path ) : ChangeProfilePictureAccountResponse
$path string File path of Profile Picture to Upload
return Instagram\API\Response\ChangeProfilePictureAccountResponse

commentOnMedia() public method

Comment on Media
public commentOnMedia ( string | FeedItem $mediaId, string $comment ) : CommentMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to Comment on
$comment string Comment
return Instagram\API\Response\CommentMediaResponse

deleteCommentsFromMedia() public method

Delete Media Comments
public deleteCommentsFromMedia ( string | FeedItem $mediaId, array $commentIds ) : API\Response\BulkDeleteCommentsMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to Delete Comments from
$commentIds array Array of Comment Ids to Delete
return API\Response\BulkDeleteCommentsMediaResponse

deleteMedia() public method

Delete Media
public deleteMedia ( string | FeedItem $mediaId, string $mediaType ) : DeleteMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to Delete
$mediaType string Media Type (Constants available in DeleteMediaRequest class)
return Instagram\API\Response\DeleteMediaResponse

editMedia() public method

Edit Media
public editMedia ( string | FeedItem $mediaId, string $caption = null ) : EditMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to Edit
$caption string Caption for this Media
return Instagram\API\Response\EditMediaResponse

editUserProfile() public method

Edit User Profile
public editUserProfile ( string $firstname = null, string $email = null, string $phoneNumber = null, integer $gender = null, string $biography = null, string $externalUrl = null ) : EditProfileAccountResponse
$firstname string First Name
$email string Email
$phoneNumber string Phone Number
$gender integer Gender (Constants available in User class)
$biography string Biography
$externalUrl string External Url
return Instagram\API\Response\EditProfileAccountResponse

followUser() public method

Follow User
public followUser ( string | User $userId ) : CreateFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to Follow
return Instagram\API\Response\CreateFriendshipResponse

generateDeviceId() public method

public generateDeviceId ( $seed ) : string
$seed
return string

getCSRFToken() public method

public getCSRFToken ( ) : string
return string

getCookies() public method

public getCookies ( ) : array
return array

getCurrentUserAccount() public method

Get Current User Account
public getCurrentUserAccount ( ) : CurrentUserAccountResponse
return Instagram\API\Response\CurrentUserAccountResponse

getDeviceId() public method

public getDeviceId ( ) : string
return string

getGUID() public method

public getGUID ( ) : string
return string

getGoogleAdId() public method

public getGoogleAdId ( ) : string
return string

getLikedFeed() public method

Fetch Liked Feed
public getLikedFeed ( string $maxId = null ) : LikedFeedResponse
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\LikedFeedResponse

getLocationFeed() public method

Fetch Location Feed
public getLocationFeed ( string | Location $locationId, string $maxId = null ) : LocationFeedResponse
$locationId string | Instagram\API\Response\Model\Location Location or Location Id to get Feed of
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\LocationFeedResponse

getLoggedInUser() public method

public getLoggedInUser ( ) : User
return Instagram\API\Response\Model\User

getMediaComments() public method

Get Media Comments
public getMediaComments ( string | FeedItem $mediaId, string $maxId ) : CommentsMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id of Media to get Comments from
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\CommentsMediaResponse

getMediaInfo() public method

Get Media Info
public getMediaInfo ( string | FeedItem $mediaId ) : InfoMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to get Info of
return Instagram\API\Response\InfoMediaResponse

getMyUserFeed() public method

Fetch My User Feed
public getMyUserFeed ( string $maxId = null ) : UserFeedResponse
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\UserFeedResponse

getPhoneId() public method

public getPhoneId ( ) : string
return string

getProxy() public method

Get the HTTP Proxy to be used for Instagram API Requests
public getProxy ( ) : string
return string

getProxyCredentials() public method

Get the HTTP Proxy Credentials to be used for Instagram API Requests
public getProxyCredentials ( ) : string
return string

getRankToken() public method

public getRankToken ( ) : string
return string

getTagFeed() public method

Fetch Tag Feed
public getTagFeed ( string $tag, string $maxId = null ) : TagFeedResponse
$tag string Tag
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\TagFeedResponse

getTimelineFeed() public method

Fetch Timeline Feed
public getTimelineFeed ( string $maxId = null ) : TimelineFeedResponse
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\TimelineFeedResponse

getUUID() public method

public getUUID ( ) : string
return string

getUserByUsername() public method

Get User by Username
public getUserByUsername ( string $username ) : User
$username string Username to find User by
return Instagram\API\Response\Model\User

getUserFeed() public method

Fetch User Feed
public getUserFeed ( string | User $userId, string $maxId = null ) : UserFeedResponse
$userId string | Instagram\API\Response\Model\User User or User Id to get Feed of
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\UserFeedResponse

getUserFollowers() public method

Get User Followers
public getUserFollowers ( string | User $userId, string $maxId ) : FollowersFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to get Followers of
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\FollowersFriendshipResponse

getUserFollowing() public method

Get User Following
public getUserFollowing ( string | User $userId, string $maxId ) : FollowingFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to get Following of
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\FollowingFriendshipResponse

getUserInfo() public method

Get User Info
public getUserInfo ( string | User $userId ) : InfoUserResponse
$userId string | Instagram\API\Response\Model\User User or User Id to get Info of
return Instagram\API\Response\InfoUserResponse

getUserMap() public method

Get GeoMedia from Map of User
public getUserMap ( string | User $userId ) : UserMapResponse
$userId string | Instagram\API\Response\Model\User User or User Id to get GeoMedia of
return Instagram\API\Response\UserMapResponse

getUserRankToken() public method

public getUserRankToken ( ) : string
return string

getUserTagsFeed() public method

Fetch User Tags Feed
public getUserTagsFeed ( string | User $userId, string $maxId = null ) : UserTagsFeedResponse
$userId string | Instagram\API\Response\Model\User User of User Id to get Tags Feed of
$maxId string Next Maximum Id, used for Pagination
return Instagram\API\Response\UserTagsFeedResponse

initFromSavedSession() public method

Initialize the Instagram instance from a previously saved session
See also: Instagram::saveSession()
public initFromSavedSession ( $session )
$session string Instagram session JSON

isLoggedIn() public method

public isLoggedIn ( ) : boolean
return boolean

likeMedia() public method

Like Media
public likeMedia ( string | FeedItem $mediaId ) : API\Response\LikeMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to Like
return API\Response\LikeMediaResponse

login() public method

Login to Instagram with Credentials
public login ( $username, $password ) : LoginResponse
$username string Instagram Username
$password string Instagram Password
return Instagram\API\Response\LoginResponse

logout() public method

Logout
public logout ( ) : API\Response\LogoutResponse
return API\Response\LogoutResponse

postPhoto() public method

Post Photo to Timeline
public postPhoto ( string $path, string $caption = null ) : ConfigureMediaResponse
$path string File path of Photo to Post
$caption string Caption for this Photo
return Instagram\API\Response\ConfigureMediaResponse

removeProfilePicture() public method

Remove Profile Picture
public removeProfilePicture ( ) : ChangeProfilePictureAccountResponse
return Instagram\API\Response\ChangeProfilePictureAccountResponse

saveSession() public method

Save the current Instagram session to a JSON string
See also: Instagram::initFromSavedSession()
public saveSession ( ) : string
return string Instagram session as JSON string

searchFacebookPlaces() public method

Search Facebook Places
public searchFacebookPlaces ( string $query ) : PlacesFacebookSearchResponse
$query string Place to Search for
return Instagram\API\Response\PlacesFacebookSearchResponse

searchFacebookPlacesByLocation() public method

Search Facebook Places by Location
public searchFacebookPlacesByLocation ( string $latitude, string $longitude ) : PlacesFacebookSearchResponse
$latitude string Latitude
$longitude string Longitude
return Instagram\API\Response\PlacesFacebookSearchResponse

searchTags() public method

Search Tags
public searchTags ( string $query ) : SearchTagsResponse
$query string Tag to Search for
return Instagram\API\Response\SearchTagsResponse

searchUsers() public method

Search Users
public searchUsers ( string $query ) : SearchUsersResponse
$query string User to Search for
return Instagram\API\Response\SearchUsersResponse

setAccountPrivate() public method

Set Account as Private
public setAccountPrivate ( ) : SetPrivateAccountResponse
return Instagram\API\Response\SetPrivateAccountResponse

setAccountPublic() public method

Set Account as Public
public setAccountPublic ( ) : SetPublicAccountResponse
return Instagram\API\Response\SetPublicAccountResponse

setCookies() public method

public setCookies ( array $cookies )
$cookies array

setCsrfToken() public method

public setCsrfToken ( string $csrfToken )
$csrfToken string

setDeviceId() public method

public setDeviceId ( string $deviceId )
$deviceId string

setGoogleAdId() public method

public setGoogleAdId ( string $googleAdId )
$googleAdId string

setGuid() public method

public setGuid ( string $guid )
$guid string

setLoggedInUser() public method

public setLoggedInUser ( User $loggedInUser )
$loggedInUser Instagram\API\Response\Model\User

setPhoneId() public method

public setPhoneId ( string $phoneId )
$phoneId string

setProxy() public method

Set the HTTP Proxy to be used for Instagram API Requests
public setProxy ( $proxy, string $username = null, string $password = null )
$proxy string Proxy
$username string Proxy Username
$password string Proxy Password

setRankToken() public method

public setRankToken ( string $rankToken )
$rankToken string

setUuid() public method

public setUuid ( string $uuid )
$uuid string

setVerifyPeer() public method

Enable/Disable SSL Verification of Peer
public setVerifyPeer ( $verifyPeer )
$verifyPeer boolean

setupAsNewDevice() public method

Setup this instance with a fresh GUID, UUID and Phone ID.
public setupAsNewDevice ( )

shouldVerifyPeer() public method

SSL Verification of Peer
public shouldVerifyPeer ( ) : string
return string

showFriendship() public method

Show Friendship between User
public showFriendship ( string | User $userId ) : ShowFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to show Friendship between
return Instagram\API\Response\ShowFriendshipResponse

unblockUser() public method

Unblock User
public unblockUser ( string | User $userId ) : UnblockFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to Unblock
return Instagram\API\Response\UnblockFriendshipResponse

unfollowUser() public method

Unfollow User
public unfollowUser ( string | User $userId ) : DestroyFriendshipResponse
$userId string | Instagram\API\Response\Model\User User or User Id to Unfollow
return Instagram\API\Response\DestroyFriendshipResponse

unlikeMedia() public method

Unlike Media
public unlikeMedia ( string | FeedItem $mediaId ) : API\Response\UnlikeMediaResponse
$mediaId string | Instagram\API\Response\Model\FeedItem FeedItem or FeedItem Id to Unlike
return API\Response\UnlikeMediaResponse