Leandro Lopes
Leandro Lopes

Reputation: 1

Post a scheduled feed with Facebook sdk

When I try to post a scheduled feed, I send beyond the normal parameters I send published parameter and scheduled_publish_time. But the error message "Uncaught OAuthException: (# 100) The specified scheduled publish time is invalid." Already made ​​several changes to the format of the date I got no more success.

The last one I tried is:

$date = date_parse_from_format('d/m/Y H:i:s', '31/05/2013 22:00:00'); $date = gmdate (DATE_ISO8601, mktime($date['hour'],$date['minute'],$date['second'],$date['month'],$date['day'],$date['year'])); $content['scheduled_publish_time'] = strtotime($ date);

Upvotes: 0

Views: 4097

Answers (1)

rharvey
rharvey

Reputation: 2005

When I got the error it was because the scheduled_publish_time I was setting was less than 10 minutes.

According to facebook the "time when the page post should go live, this should be between 10 mins and 6 months from the time of publishing the post".

https://developers.facebook.com/docs/reference/api/page/

Also it must be a unix epoch timestamp and you don't have to worry about timezones either.

Hope this helps.

UPDATE:

I use the Facebook PHP SDK.

$post = $facebook->api("/v2.2/$pageName/$insight", 'post', $args);

and in my $args variables I have

$args  = array(
'scheduled_publish_time' => $epochTime,
'published' => 0
);

where $epochTime is something like this

$epochTime = strtotime("2015-04-07 09:00:00");

Upvotes: 4

Related Questions