I have been trying to post a status at scheduled date/time to Facebook using PHP cURL.
I am using the unix timestamp value to the parameter scheduled_publish_time
and published=false
. In Facebook I can see my post being scheduled at the given time.
but unfortunately nothing gets posted at that time and Facebook still shows the message as "next post scheduled for #time" even after the time has elapsed.
Code:
<?php
$facebook_page_id='xxx';
$facebook_page_access_token="xxx";
//Facebook page post
$status='scheduled post';
$fb_page_post="https://graph.facebook.com/{$facebook_page_id}/feeds?message=$status&scheduled_publish_time=1431683900&published=false&access_token=$facebook_page_access_token";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $fb_page_post);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_REFERER, '');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$fb_page_post = json_decode(curl_exec($ch));
curl_close($ch);
var_dump($fb_page_post);
when I run this script through terminal and var_dump()
the response it gives me an output as :
object(stdClass)#2 (2) {
["id"]=>
string(16) "1414369492218829"
["post_id"]=>
string(33) "1387602394895539_1414369492218829"
}
what is the solution for this ? What necessary changes do I need to make ?
Thank you for any Help