php 使用脚本将照片上传到 Instagram

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23853579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:00:23  来源:igfitidea点击:

Uploading photos to instagram, using a script

phpinstagramphotos

提问by reidjako

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

是否可以将照片从网页上传到 Instagram,如果可以,您将如何操作?

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!

我想知道如何做到这一点,所以我可以有一个网站,人们可以在其中投票给他们最喜欢的照片,并且每天都会发布得票最多的照片!

采纳答案by reidjako

Uploading on Instagram is possible.

可以在 Instagram 上传。

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

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

检查此代码,例如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!

我的挑战是让人们修复这个脚本,所以它是独立的!

回答by jedi

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

你可以使用这个 API:https: //github.com/mgp25/Instagram-API

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

以下是如何将照片上传到 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();
}

回答by zac

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.

试试这个:http: //lancenewman.me/posting-a-photo-to-instagram-without-a-phone/- 对我来说很好用,第一次运行会失败,因为你需要先授权连接。只需使用网站登录 Instagram 并在出现提示时选择“这是我” - 之后它就像一个魅力。您的帐户可能还需要处于活动状态才能进行此类操作,我之前在 API 发布时遇到了问题如果帐户上没有帖子,则不起作用,因此根据一般经验,我们首先从设备上手动发布一些帖子。

Hope this helps you.

希望这对你有帮助。