Uploading photos to instagram, using a script

reidjako picture reidjako · May 25, 2014 · Viewed 20.8k times · Source

Is it possible to upload photos from a webpage to Instagram, if so how do you do it?

I am wondering how to do this, so I can have a website where people can vote on their favourite photo and the one with most votes will be posted each day!

Answer

jedi picture jedi · Nov 28, 2015

You can use this API: https://github.com/mgp25/Instagram-API

And here is an example how to upload photo to Instagram:

<?php
require '../src/Instagram.php';
/////// CONFIG ///////
$username = '';
$password = '';
$debug    = false;
$photo    = '';     // path to the photo
$caption  = null;   // caption
//////////////////////
$i = new Instagram($username, $password, $debug);
try{
  $i->login();
} catch (InstagramException $e)
{
  $e->getMessage();
  exit();
}
try {
  $i->uploadPhoto($photo, $caption);
} catch (Exception $e)
{
  echo $e->getMessage();
}