Question: Facebook Graph API to Post to Page not working on new server

Question

Facebook Graph API to Post to Page not working on new server

Answers 1
Added at 2017-01-05 22:01
Tags
Question

So I have been using the below code on my shared hosting server and it has been working fine but now we have moved to a dedicated server but this script is not working?

The dedicated server has CentOS 6.8, Apache 2.2, PHP 7.0.14, MySQL 5.6 and does have curl installed.

I am using a permanent access token also.

$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"];

I cannot find any errors in the console, is there any way for me to debug this?

Answers to

Facebook Graph API to Post to Page not working on new server

nr: #1 dodano: 2017-01-05 23:01

Figured it out. I didn't force SSL on the old server but do on the new server so the below line needed to be added after curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Source Show
◀ Wstecz