how to get the twitter server time (synchronize)?

FeedPing
@FeedPing Feed Ping

Is there a way to get the twitter server-time ?
on my server the time(stamp) differs from the twitter-(server-)time .. about 20 seconds
sometimes i get minus Seconds (e.g. "Tweet posted -12 seconds ago") ...

how to get the timestamp of the twitter-server ? ... to synchronize ... is it possible?
THX

2 years 8 weeks ago

Replies

episod
@episod Taylor Singletary

The current time that Twitter "thinks" it is is returned in the "Date" HTTP header of every response to an API call you make. You can also issue a simple HTTP HEAD request to GET help/test to get the header as an initial syncing step for your app.

2 years 8 weeks ago
FeedPing
@FeedPing Feed Ping

Thanks, that works fine for me with the HTTP HEADER of my $request_url

  1. $srvstamp = time();     // ---- server timestamp ---- 
  2. $twheader = get_headers($request_url, 1);   // ---- array with ['Date'] string
  3. $twistamp = strtotime($twheader['Date']);   // ---- twitter timestamp
  4. echo "<br /> Server: ".date("Y.m.d (H:i:s)",$srvstamp)." - ".$srvstamp." \r\n"; 
  5. echo "<br /> Twitter: ".date("Y.m.d (H:i:s)",$twistamp)." - ".$twistamp." \r\n"; 

twitter seems to be some seconds in the future, or my server in the past ^^ however ^^

2 years 8 weeks ago
NFutbolVE
@NFutbolVE Nuestro Fútbol

i cant sync my time server with twitter server, i need help in spanish please

40 weeks 22 hours ago