Reputation: 3920
I have a dedicated server hosted at OVH and I have the following PHP CURL script that calls the Facebook Graph API to post on a user wall:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/v2.6/'.$user.'/feed');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'link='.$link.'&access_token=************');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if(curl_errno($ch)){
error_log(curl_error($ch));
}
else {
error_log($response);
}
The expected behavior is that the script should log the facebook response. I noticed a LOT of times, the script doesn't return ANY response at all and not even a CURL error.
I have also a script that uses file_get_contents
. I noticed also that every few days I suddenly get a huge amount of connection timed out
calling the Facebook Graph API. It happens randomly and for no reason!
When I try to call the same URL from browser immediately after it's logged in the error log, it works successfully.
I'm really confused :( Do you think these are connectivity issues with OVH servers or the Graph API or what?
Thanks
Upvotes: 1
Views: 916
Reputation: 363
wanted to comment, not post an answer but I don't have enough rep :(
For https using curl I usually add:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Upvotes: 1