Instagram PHP Documentation

Similar documents
Firebase PHP SDK. Release

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

X Generic Event Extension. Peter Hutterer

git-pr Release dev2+ng5b0396a

Java Relying Party API v1.0 Programmer s Guide

Feed Cache for Umbraco Version 2.0

agate-sql Documentation

mp3fm Documentation Release Akshit Agarwal

MCAFEE THREAT INTELLIGENCE EXCHANGE RESILIENT THREAT SERVICE INTEGRATION GUIDE V1.0

PHP-FCM Documentation

Sensor-fusion Demo Documentation

utidylib Documentation Release 0.4

Daedalus Documentation

deepatari Documentation

Dependency Injection Container Documentation

Tailor Documentation. Release 0.1. Derek Stegelman, Garrett Pennington, and Jon Faustman

XEP-0099: IQ Query Action Protocol

delegator Documentation

sensor-documentation Documentation

josync Documentation Release 1.0 Joel Goop and Jonas Einarsson

retask Documentation Release 1.0 Kushal Das

Asthma Eliminator MicroMedic Competition Entry

TWO-FACTOR AUTHENTICATION Version 1.1.0

twstock Documentation

Dellve CuDNN Documentation

BME280 Documentation. Release Richard Hull

disspcap Documentation

Elegans Documentation

SopaJS JavaScript library package

PyCon APAC 2014 Documentation

Imagination Documentation

Colgate, WI

Firebase Admin SDK for PHP. Release

inflection Documentation

jumpssh Documentation

Testworks User Guide. Release 1.0. Dylan Hackers

RTI Connext DDS Core Libraries

Magister 6 API Documentation

Magister 6 API Documentation

Industries Package. TARMS Inc.

Open Source Used In Cisco Configuration Professional for Catalyst 1.0

puppet-diamond Documentation

Spotter Documentation Version 0.5, Released 4/12/2010

XEP-0104: HTTP Scheme for URL Data

aiounittest Documentation

Inptools Manual. Steffen Macke

CuteFlow-V4 Documentation

Navigator Documentation

RSA Two Factor Authentication

Django Mail Queue Documentation

Bluetooth Low Energy in C++ for nrfx Microcontrollers

dublincore Documentation

XEP-0087: Stream Initiation

NDIS Implementation Guide

docxtemplater Documentation

XStatic Documentation

Piexif Documentation. Release 1.0.X. hmatoba

The XIM Transport Specification

XTEST Extension Library

Transparency & Consent Framework

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

XEP-0399: Client Key Support

XEP-0206: XMPP Over BOSH

Imagination Documentation

invenio-formatter Documentation

Migration Tool. Migration Tool (Beta) Technical Note

Piexif Documentation. Release 1.0.X. hmatoba

Preprocessing of fmri data

Firebase Admin SDK for PHP

MEAS HTU21D PERIPHERAL MODULE

HTNG Web Services Product Specification. Version 2011A

SW MAPS TEMPLATE BUILDER. User s Manual

sanction Documentation

ExaFMM. Fast multipole method software aiming for exascale systems. User's Manual. Rio Yokota, L. A. Barba. November Revision 1

ProFont began life as a better version of Monaco 9 which is especially good for programmers. It was created circa 1987 by Andrew Welch.

MatPlotTheme Documentation

Guest Book. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

XEP-0056: Business Data Interchange

abstar Documentation Release Bryan Briney

RTXAGENDA v Use Manual. A program, free and easy to use, to modify your RT4, RT5 or RT6 phonebook, on PC.

HTNG Web Services Product Specification. Version 2014A

International Color Consortium

MEAS TEMPERATURE SYSTEM SENSOR (TSYS01) XPLAINED PRO BOARD

SWTP 6800 Simulator Usage 27-Mar-2012

XEP-0044: Full Namespace Support for XML Streams

Chargify SDK for PHP Documentation

XEP-0140: Shared Groups

LANDISVIEW Beta v1.0-user Guide

XEP-0361: Zero Handshake Server to Server Protocol

Upgrading BankLink Books

webbot Documentation Release Natesh M Bhat

RTXAGENDA v Use Manual. A program, free and easy to use, to modify your RT4 phonebook, on PC.

The XIM Transport Specification

Additional License Authorizations for HPE OneView for Microsoft Azure Log Analytics

Packet Trace Guide. Packet Trace Guide. Technical Note

Quality of Service (QOS) With Tintri VM-Aware Storage

iwrite technical manual iwrite authors and contributors Revision: 0.00 (Draft/WIP)

Using OAuth 2.0 to Access ionbiz APIs

Folder Poll General User s Guide

Statsd Metrics Documentation

Transcription:

Instagram PHP Documentation Release 0.1.0 Marvin Osswald Feb 12, 2018

Contents 1 Overview 3 1.1 Requirements............................................... 3 1.2 Installation................................................ 3 1.3 License.................................................. 4 1.4 Contributing............................................... 4 2 Quickstart 5 2.1 Access Instagram API.......................................... 5 3 Endpoints 7 3.1 Media................................................... 7 3.2 Users................................................... 10 3.3 Locations................................................. 12 3.4 Relationships............................................... 14 3.5 Tags.................................................... 16 3.6 Comments & Likes............................................ 17 4 Indices and tables 19 i

ii

Contents: Contents 1

2 Contents

CHAPTER 1 Overview 1.1 Requirements 1. PHP 5.6 or higher 2. Instagram App Note: Right now one needs an Access Token from Instagram, getting it just by the SDK isn t implemented yet. 1.2 Installation The recommended way to install Instagram PHP is with Composer. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. # Install Composer curl -ss https://getcomposer.org/installer php You can add Instagram PHP as a dependency using the composer.phar CLI: php composer.phar require marvinosswald/instagram-php:~1.0 Alternatively, you can specify Instagram PHP as a dependency in your project s existing composer.json file: } { "require": { "marvinosswald/instagram-php": "~1.0" } After installing, you need to require Composer s autoloader: 3

require 'vendor/autoload.php'; You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org. 1.3 License Licensed using the MIT license. Copyright (c) 2016 Marvin Osswald <https://github.com/marvinosswald> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software ), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARIS- ING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1.4 Contributing Always welcome! 4 Chapter 1. Overview

CHAPTER 2 Quickstart This page provides a quick introduction to Instagram PHP and introductory examples. If you have not already installed, Instagram PHP, head over to the Installation page. 2.1 Access Instagram API You can send requests with the SDK using a marvinosswald\instagram\instagram object. 2.1.1 Creating a Client use marvinosswald\instagram\instagram; $params = [ 'accesstoken' => 'your-access-token', 'clientid' => 'your-client-id' 'clientsecret' => 'your-client-secret', 'redirecturi' => 'your-redirect-uri' ] $config = [ 'allow_redirects' => false 'http_errors' => false... ]; $instagram = new Instagram($params, $config); The client constructor accepts two arrays : $params $config who can contain all GuzzleHttpClient request options see : http://docs.guzzlephp.org/en/stable/ request-options.html 5

2.1.2 Access Media Endpoint $media = $instagram->media(media_id)->get(); 6 Chapter 2. Quickstart

CHAPTER 3 Endpoints 3.1 Media 3.1.1 Constructor($id) Initalize a new Media Class with an Id or empty, $media = $instagram->media(); // with id set: $media = $instagram->media(123); Media s new instance of Media Class 3.1.2 Properties id int Media_Id data StdClass protected as soon as the object is synced with Instagram by get() this property holds the response data If loaded you can access all properties send by Instagram like: $username = $media->user->username 7

3.1.3 Methods get($id) Saves the result to the public parameter data id (optional) only if not already set at initalization $media->get(); Media s itself getbyshortcode($shortcode) Saves the result to the public parameter data shortcode $media->getbyshortcode($shortcode); Media s itself search($latitude,$longitude,$distance) latitude longitude distance (optional) $media->search($latitude,$longitude,$distance); Array s array of Media Objects 8 Chapter 3. Endpoints

comments() $media->comments(); Array s array of Comment Objects comment($text) Comments on the media object text Comment text $media->comment($text); StdClass s Comment Object deletecomment($id) Delete commment by it s comment id $id Comment Id $media->deletecomment($id); likes() $media->likes(); Array s array of Like Objects like() Likes this media Object by the current authorized user $media->like(); 3.1. Media 9

StdClass s Like Object unlike() Removes like from this media Object by the current authorized user $media->unlike(); StdClass s Like Object 3.2 Users 3.2.1 Constructor($id) Initalize a new User Class with an Id or empty, $user = $instagram->user(); // with id set: $user = $instagram->user(123); User s new instance of User Class 3.2.2 Properties id int User_Id data StdClass protected as soon as the object is synced with Instagram by get() this property holds the response data If loaded you can access all properties send by Instagram like: $username = $user->username 10 Chapter 3. Endpoints

3.2.3 Methods get($id) Properties id only if not already set at initalization User s itself self() Access authorized user User s itself getmediarecent($count,$minid,$maxid) Requests recent media objects posted by the specified user count (optional) minid (optional) maxid (optional) $user->getmediarecent($count,$minid,$maxid); Array s array of Media Objects selfmediarecent($count,$minid,$maxid) Requests recent media objects posted by the authorized user 3.2. Users 11

count (optional) minid (optional) maxid (optional) $user->selfmediarecent($count,$minid,$maxid); Array s array of User Objects selfmedialiked($count,$maxlikeid) Requests liked media objects posted by the authorized user count (optional) maxlikeid (optional) $user->getmedialiked($count,,$maxlikeid); Array s array of User Objects search($query,$count) Properties query Search query count (optional) Limit result Array s array of User Objects 3.3 Locations 3.3.1 Constructor($id) Initalize a new Location Class with an Id or empty, 12 Chapter 3. Endpoints

$location = $instagram->location(); // with id set: $location = $instagram->location(123); Location s new instance of Location Class 3.3.2 Properties id int Location_Id data StdClass protected as soon as the object is synced with Instagram by get() this property holds the response data If loaded you can access all properties send by Instagram like: $latitude = $location->latitude 3.3.3 Methods get($id) id only if not already set at initalization Location s itself recentmedia($mintagid,$maxtagid) Properties mintagid (optional) maxtagid (optional) Array s array of Media Objects 3.3. Locations 13

searchbycoordinates($lat,$lng,$distance) Properties latitude longitude distance (optional) Limit radius, default is 500m Array s array of Location Objects searchbyfbplaces($fb_places_id,$distance) Properties fb_places_id A Place id issued by Facebook distance (optional) Limit radius, default is 500m Array s array of Location Objects 3.4 Relationships 3.4.1 Constructor() Initalize a new Relationship Class, $relationship = $instagram->relationship(); Relationship s new instance of Relationship Class 3.4.2 Methods follows() s User the authorized User is following Array s array of User Objects 14 Chapter 3. Endpoints

followers() s User who are following the authorized User Array s array of User Objects followingrequests() s all open following requests. with() Get information about a relationship to another user. Relationships are expressed using the following terms in the response: outgoing_status: Your relationship to the user. Can be follows, requested, none. incoming_status: A user s relationship to you. Can be followed_by, requested_by, blocked_by_you, none. follow($target) s target Id of user to follow unfollow($target) s target Id of user not to follow anymore approve($target) s target Id of user to approve request ignore($target) s target Id of user to ignore request 3.4. Relationships 15

3.5 Tags 3.5.1 Constructor($tagname) 3.5.2 Properties id int Tag name data StdClass protected as soon as the object is synced with Instagram by get() this property holds the response data If loaded you can access all properties send by Instagram like: $media_count = $tag->media_count Initalize a new Tag Class with an Tagname or empty, $tag = $instagram->tag(); // with id set: $tag = $instagram->tag(123); Tag s new instance of Tag Class 3.5.3 Methods get($id) id only if not already set at initalization Tag s itself recentmedia($count,$mintagid,$maxtagid) count (optional) mintagid (optional) maxtagid (optional) 16 Chapter 3. Endpoints

Array s array of Media objects search($query) query Search query Array of Tag Objects 3.6 Comments & Likes Both of these Endpoints are embedded into the Media Class 3.6. Comments & Likes 17

18 Chapter 3. Endpoints

CHAPTER 4 Indices and tables genindex modindex search 19