对 Facebook API 的简单 PHP CURL 请求不起作用?
我有一个照片应用程序,用户可以在其中创建相册。我担心的是,如果他们通过 Facebook 删除相册并尝试上传该相册中的另一张图片,那么要么不起作用,要么创建一个默认相册并将其上传到该相册。
所以我的想法是在上传图片之前检查相册是否存在。这是我的代码:
exec("curl https://graph.facebook.com/10150160401046994?access_token=i_have_a_access_token_here_but_i_dont_want_to_share_it", $hi);
print_r("$hi");
但是,输出时我只得到“ARRAY”。我真的很想看看 Facebook 说了什么,就像你访问该页面一样。
提前致谢
库尔顿
I have a photo application where the user can create albums. My concern is that if they delete the album via facebook andthey try to upload another picture in that album, it's eaither not going to work or create a default album and upload it to that.
So what I was thinking was to check if the album exists before uploading a picture. Here's the code I have:
exec("curl https://graph.facebook.com/10150160401046994?access_token=i_have_a_access_token_here_but_i_dont_want_to_share_it", $hi);
print_r("$hi");
However, when outputting I just get "ARRAY". I really want to see what Facebook says just as if you went to the page.
Thanks in advance
Coulton
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是否有任何可能的原因不能使用curl 来实现此目的?
Is there any possible reason you can't use curl for this?
第一个问题,使用PHP的Curl库。如果可以的话,让我们远离
exec
:P其次,当将
Array
转换为String
时,转换后的字符串等于"数组”
。如果您只想快速转储信息,请使用var_dump( $hi );
First problem, use PHP's Curl library. Let's stay away from
exec
if we can :PSecond, when converting and
Array
to aString
the converted string is equal to"Array"
. If you just want a quick dump of the information usevar_dump( $hi );