passing timespan to facebook open graph

。_饼干妹妹 提交于 2020-01-15 03:36:26

问题


How can I specify the time for my action to be presented in present or past? I've tried -

$facebook -> api('/me/myapp:read', 'POST', array('expires_in' => '180', 'start_time' => date('c'), 'access_token' => $this -> session -> userdata('ftoken'), 'object' => base_url() . $data['link']));

but that doesn't work - so what am I not getting?

Explanation :read is actually just the action in my facebook app. The post is happening and the "read" action is getting logged, the problem is that it is always presented in "past" as in

Jakob read dadada on http://mysite.com

and not in present

Jakob is reading dadad on http://mysite.com

My question is how I can have facebook present the status as is reading for 3 minutes after the action has been submitted (hence the 'expires_in' => '180' which is 180 seconds equal to three minutes)


回答1:


If your start time is now, the easiest way is to specify "expires_in" as a POST variable. This is an optional parameter and will denote the duration (in seconds) for which your action should remain in the present tense.

From the documentation:

expires_in (integer)

The number of seconds before this action is considered “old”. From the time the action until expires_in seconds have elapsed, the action is considered “present tense”, and afterwards, it is considered “past tense”.

expires_in is a shortcut for specifying end_time when it’s more convenient to provide a delta in seconds between when an action started and when it ends. For example, when a user starts watching a movie, when you post a watch action, expires_in should be the length of the movie in seconds.




回答2:


Jakob, what are you trying to do?

$facebook -> api('/me/myapp:read', 'POST', array('expires_in' => '180', 'start_time' => date('c'), 'access_token' => $this -> session -> userdata('ftoken'), 'object' => base_url() . $data['link']));

When you update something on Facebook, you issue POST command (2nd parm), what you are updating (1st parm; your wall, event, etc) and whatever data in the 3rd.

If you are trying to read something issue GET command. Not sure if you're trying to get all wall posts in your app or not. But if yes, try this:

$facebook->api('/YOURAPPID/feed?access_token'.$this -> session -> userdata('ftoken'),'GET');

UPDATE

Misunderstood the original question. Your call seems correct. If you're posting an action to your app and you configured Past/Present tenses (and plural versions) correctly in your Action Config page, it should display "reading" for 3 minutes and "read" after.



来源:https://stackoverflow.com/questions/8112907/passing-timespan-to-facebook-open-graph

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