Call Instagram API from localhost

匆匆过客 提交于 2019-12-12 09:40:19

问题


Is it possible to get INSTAGRAM user details through API from localhost ?

Because I am trying to doing this from localhost but unable to fetch the information. After click the login url it redirect me to the INSTAGRAM and after successfully login and authorize the apps it redirect me properly in my callback URL with code. But when I am trying to fetch the info (cURL) using access token then it return null.

But same code run perfectly in live.


回答1:


Make sure the Curl option CURLOPT_SSL_VERIFYPEER is set to false. Find the Curl request in your code and add or edit an option that will look something like this:

$ch = curl_init();
...
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  <<-- Add this line



回答2:


Ultimately I resolved the problem. now I am able to connect to Instagram.

I use the CodeIgniter Instagram Library by Ian Luckraft. In config file I just change the

$config['instagram_ssl_verify'] = FALSE;

By default it was TRUE.




回答3:


Yes it is possible.
You can try using Instagram api wrapper which is made by Galen Grover
https://github.com/galen/PHP-Instagram-API Mine's works just fine




回答4:


in instagram .config.php in your localhost 
you must  set 'apiCallback' =>

to  'http://localhost/instagram/instagram/'


folder of your success.php


<?php
// Setup class
  $instagram = new Instagram(array(
    'apiKey'      => '',
    'apiSecret'   => '',
    'a
?>piCallback' => 'http://localhost/instagram/instagram/' // must point to success.php
  ));


来源:https://stackoverflow.com/questions/16358906/call-instagram-api-from-localhost

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