所以我一直在我的共享托管服务器上使用以下代码并且它一直运行良好但现在我们已经转移到专用服务器但是这个脚本不起作用?
专用服务器有 CentOS 6.8、Apache 2.2、PHP 7.0.14、MySQL 5.6,并安装了 curl。
我也在使用永久访问 token 。
$data['access_token'] = '{my permanent access token}';
$post_url = 'https://graph.facebook.com/{my feed ID}/feed';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($ch);
curl_close($ch);
$dec = (Array)json_decode($return);
$link = "https://www.facebook.com/".$dec["id"];
我在控制台中找不到任何错误,我有什么办法可以调试它吗?
最佳答案
想通了。我没有在旧服务器上强制使用 SSL,而是在新服务器上强制使用 SSL,因此需要在 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
关于php - 用于发布到页面的 Facebook Graph API 无法在新服务器上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41495450/