简体   繁体   English

当我使用graph-api时,为什么file_get_contents不能与https一起使用?

[英]Why file_get_contents doen't work with https when I use graph-api?

file_get_contents('https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN_HERE');

When I open this link in browser with my access token It gives a list of all of my Facebook pages and when I try to echo it with file_get_contents , it gives the following error: 当我使用访问令牌在浏览器中打开此链接时,它给出了我所有Facebook页面的列表,当我尝试使用file_get_contents回显它时,它给出了以下错误:

Warning: file_get_contents( https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN_HERE ) [function.file-get-contents]: failed to open stream: Permission denied in /home/www/ * ** * ** * ** * * .php on line 4 警告:file_get_contents( https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN_HERE )[function.file-get-contents]:无法打开流:/ home / www /中的权限被拒绝* * * * * * ** * * .php第4行

Also file_get_contents works fine with any other website. 另外, file_get_contents可以与任何其他网站正常工作。

Try with curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 尝试使用curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); before every line containing curl_exec in base_facebook.php if you are using php sdk. 如果您使用的是PHP sdk,则在base_facebook.php中每个包含curl_exec行之前。 If it works then you can at lease know where the issue is. 如果有效,那么您至少可以知道问题出在哪里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM