繁体   English   中英

预定用PHP cURL发布到Facebook

[英]Scheduled posting to Facebook in PHP cURL

我一直在尝试使用PHP cURL在预定的日期/时间向Facebook发布状态。

我将unix时间戳值用于参数scheduled_publish_timepublished=false 在Facebook中,我可以看到我的帖子在给定的时间安排。

但不幸的是,当时没有任何消息发布,即使时间已过,Facebook仍将消息显示为“预定于#time的下一条消息”。

码:

<?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);

当我通过终端和var_dump()运行此脚本时,响应给出的输出为:

object(stdClass)#2 (2) {
["id"]=>
string(16) "1414369492218829"
["post_id"]=>
string(33) "1387602394895539_1414369492218829"
}

解决方案是什么? 我需要进行哪些必要的更改?

感谢您的任何帮助

删除published=false 这意味着,没有饲料的故事应该被创建, 在所有

使用scheduled_publish_time即可创建计划的帖子,仅当达到指定的时间戳记时,该帖子才会出现在页面的时间轴上。

https://developers.facebook.com/docs/graph-api/common-scenarios#scheduledposts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM