Upload photos for past date

半城伤御伤魂 提交于 2019-11-28 07:42:29

I'm an Engineer at FB, but not on the Platform team so I'm not 100% up to date on this. There is an undocumented field 'backdated_time' available on the photo uploader in the Graph API. I assume it's supernew and will be being doc'd over the next few weeks, but feel free to try it in the interim (and report back here!).

It takes an ISO-8601 timestamp by the looks of it.

The docs team have been chased to figure out what's going on.

Also, DMCS isn't quite right. FB Engineers (particularly those in our Developer Support team) are encouraged to hang out here to help with questions, and each week on our developer blog we post how many questions were asked and how many were answered. So there is a commitment to getting questions on SO answered - see https://developers.facebook.com/blog/post/625/ as an example.

However, there's a difference between support of existing features and bugs/requests for new features. If you have a bug or feature request, add it to http://developers.facebook.com/bugs.

Thanks!

I would assume with how new the timeline is, that this is a Facebook bug or an enhancement that needs to be made to the API. Have you submitted this to Facebook?

Stan James

The following code works. (Combines this FB example code with mrtom's undocumented field.)

<?php

$app_id = "YOUR_APP_ID";
$app_secret = "YOUR_APP_SECRET";
$post_login_url = "YOUR_POST_LOGIN_URL"; // should be the URL of this script

$code = $_REQUEST["code"];

//Obtain the access_token with publish_stream permission
if(empty($code)) {
  $dialog_url= "http://www.facebook.com/dialog/oauth?"
   . "client_id=" .  $app_id
   . "&redirect_uri=" . urlencode( $post_login_url)
   .  "&scope=publish_stream";
  echo("<script>top.location.href='" . $dialog_url
  . "'</script>");
}
else {

  $token_url="https://graph.facebook.com/oauth/access_token?"
   . "client_id=" . $app_id
. "&redirect_uri=" . urlencode( $post_login_url)
   . "&client_secret=" . $app_secret
   . "&code=" . $code;
  $response = file_get_contents($token_url);
  $params = null;
  parse_str($response, $params);
  $access_token = $params['access_token'];

 // Show photo upload form to user and post to the Graph URL
 $graph_url= "https://graph.facebook.com/me/photos?"
 . "access_token=" .$access_token;

 echo '<html><body>';
 echo '<form enctype="multipart/form-data" action="'
 .$graph_url .' "method="POST">';
 echo 'Please choose a photo: ';
 echo '<input name="source" type="file"><br/><br/>';
 echo 'Say something about this photo: ';
 echo '<input name="message"
     type="text" value=""><br/><br/>';
 echo 'ISO Date for this photo: ';
 echo '<input name="backdated_time"
     type="text" value=""><br/><br/>';

 echo '<input type="submit" value="Upload"/><br/>';
 echo '</form>';
 echo '</body></html>';
}

?>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!