Uploading photos to instagram, using a script

南笙酒味 提交于 2019-12-03 07:46:17

问题


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!


回答1:


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();
}



回答2:


Try this: http://lancenewman.me/posting-a-photo-to-instagram-without-a-phone/ - works nicely for me, the first run will fail though as you would need to authorize the connection first. Just login to Instagram using the web site and select "It Was Me' when prompted - after that it works like a charm. Your account may also need to be active for this type of thing to work, I had an issue previously where API posts didn't work if there were no posts on the account so as a general rule of thumb we do a few manual posts first from a device.

Hope this helps you.




回答3:


Uploading on Instagram is possible.

POST https://instagram.com/api/v1/media/upload/

Check this code for example https://code.google.com/p/twitubas/source/browse/common/instagram.php

My challenge is out for people to fix this script so it is stand alone!



来源:https://stackoverflow.com/questions/23853579/uploading-photos-to-instagram-using-a-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!