php – 使用脚本将照片上传到instagram

前端之家收集整理的这篇文章主要介绍了php – 使用脚本将照片上传到instagram前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
是否可以将照片从网页上传到Instagram,如果是这样,你怎么做?

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

您可以使用此API: https://github.com/mgp25/Instagram-API

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

猜你在找的PHP相关文章