Instagram API.“无法访问回调网址" [英] Instagram API. "Unable to reach callback url"

查看:27
本文介绍了Instagram API.“无法访问回调网址"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这里是设置.我正在为节日开发一个网站,需要使用 Instragram API.客户端希望自动从 Instagram 加载使用特定主题标签的图片.这里没问题,instagram API 支持此功能以及更多功能.

但是当我尝试进行订阅(通过 cURL 发布操作)时,我收到一个错误响应,指出我的回调 url 无法访问.但它是可达的.我可以通过浏览器浏览它,没问题.

我的 cURL 操作如下所示:

$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_HEADER, false);curl_setopt($ch, CURLOPT_POST, count($postData));curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);$result = curl_exec($ch);curl_close($ch);

这是我在执行上面的post操作后得到的响应:

{"meta":{"error_type":"APISubscriptionError","code":400,"error_message":"无法访问回调 URL \"...myUrl...\"."}}

任何在线 Instagram 大师知道我做错了什么?

注意:我尝试在我的回调 url 文件/api 以及单独的 php 文件中订阅.

解决方案

如果您使用家用电脑进行开发,请确保您提供给 Instagram 服务器的回调 url 可以访问(从他们这边)

您的计算机上可能装有防火墙(确保允许传入连接)
或者尝试在远程服务器上运行您的代码(如果您还没有)

Ok guys so here is the setup. I am developing a site for a festival and need to use the Instragram API. The client would like to automatically load pictures from Instagram that use a certain hashtag. No problem here, the instagram API supports this function and many more.

But when I try to make a subscription (via a cURL Post Operation) I get an error response that my callback-url is unreachable. But it is reachable. I can surf to it via the browser no problem.

My cURL operation looks like this:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result = curl_exec($ch);       
curl_close($ch);    

and this is the response I get after executing the post operation above:

{"meta":{"error_type":"APISubscriptionError","code":400,"error_message":"Unable to reach callback URL \"...myUrl...\"."}}

Any instagram guru's online that know what I'm doing wrong?

Note: I've tried to subscribe in both my callback-url file/api aswell as in an apart php file.

解决方案

If you're using your home computer to develop it make sure the callback url you provided to instagram's servers can be reached (from their side)

You may have a firewall on your computer (make sure you allow incoming connections)
Or try running your code on a remote server (if you're not already)

这篇关于Instagram API.“无法访问回调网址"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆