How do I get the Facebook Server Time?

2019-05-25 03:46发布

问题:

I have created a facebook iframe app using Flash on the client and .net on the server. I am using fluorineFX to communicate between the two.

I need to get the exact facebook server time from my server. This is for authenticating the user on my server so I don't want to get the time from the client and then pass it to the server. This is the only interaction I need with Facebook from my server, all other interaction is handled by the client using the old rest API.

What is the best way to do this? I have read you can use FQL but seeing as its just the time I am looking for is there a way which does not involve getting an authToken on the server?

Thanks! Tim

回答1:

You can call now() in a Facebook FQL query to get the current Facebook server time in a unix timestamp and then convert it from there however you need.

For example, here is a sample FQL query that would work without an auth token (fql statements require a where clause so I just grabbed a random fql table with a random where statement):

SELECT now() FROM link_stat WHERE url = '1.2'

The url for that query would be: https://api.facebook.com/method/fql.query?query=SELECT+now%28%29+FROM+link_stat+WHERE+url+%3D+%271.2%27&format=json

Facebook provides a FQL testing tool to help.