2013-05-03 48 views
3

是否有可能得到INSTAGRAM通過API的用戶詳細信息從localhost從本地調用Instagram API

因爲我試圖從localhost做到這一點,但無法獲取信息。 點擊登錄網址後,它會將我重定向到INSTAGRAM,並且在成功登錄並授權應用程序後,它會在我的回調網址中使用代碼正確重定向我。但是,當我試圖使用訪問令牌獲取信息(cURL)時,它會返回null。

但是相同的代碼在現場完美運行。

回答

1

最後我解決了這個問題做出Instagram的API的包裝。現在我可以連接INSTAGRAM。

我使用Ian Luckraft的CodeIgniter Instagram庫http://ianluckraft.co.uk。 在配置文件我只是改變

$ config ['instagram_ssl_verify'] = FALSE;

默認情況下它是TRUE。

:))

+0

你可以查看一個simillar視頻[這裏](https://www.youtube.com/watch?v=bWithhiVFOU) – Iftikhar 2017-01-09 09:49:45

-1

是的,這是可能的。
您可以嘗試使用由蓋倫格羅弗
https://github.com/galen/PHP-Instagram-API 礦的作品就好了

+0

抱歉地通知您,我已經使用的代碼,並無法從本地主機獲取信息。 – 2013-05-03 13:03:05

3

確保Curl option CURLOPT_SSL_VERIFYPEER設置爲false。查找代碼中的捲曲請求,並添加或編輯選項,這將是這個樣子:

$ch = curl_init(); 
... 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); <<-- Add this line 
-1
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 
));