Hi Thomas,
The timestamp must be the current time in epoch seconds. By design the epoch
time is in GMT, which is the same as Twitter's servers so you shouldn't need
to adjust it. If you do it implies your server clock isn't set correctly.
Looking at your code you have a lot going on which increases the risk of
encoding errors. To help you track down the issue have a look at the way one
of the community produced PHP libraries does it and compare their results to
yours.
You can find the community libraries on our developer resources site:
http://dev.twitter.com/pages/oauth_libraries#php
Best,
@themattharris
Developer Advocate, Twitter
http://twitter.com/themattharris
On Tue, Jan 18, 2011 at 4:33 PM, Thomas <[email protected]> wrote:
> I just tried using time() without adding 3 hours and I get this error:
> Timestamp out of bounds
> So I believe adding 3 hours is the right thing to do.
>
> On Jan 17, 9:36 pm, Yusuke Yamamoto <[email protected]> wrote:
> > Hi,
> >
> > time() returns epoch time which is an absolute value, and you don't need
> to consider timezones.http://php.net/manual/en/function.time.php
> > --
> > Yusuke Yamamoto
> > [email protected]
> >
> > this email is: [x] bloggable/tweetable [ ] private
> > follow me on :http://twitter.com/yusukeyamamoto
> > subscribe me at :http://samuraism.jp/
> >
> > On Jan 18, 2011, at 13:56 , Thomas wrote:
> >
> >
> >
> >
> >
> >
> >
> > > My servers default time is PST but twitters time is EST I believe so
> > > that's why I added 3 hours.
> >
> > > On Jan 17, 4:35 pm, "@epc" <[email protected]> wrote:
> > >> On Jan 16, 2:10 pm, Thomas <[email protected]> wrote:
> >
> > >>> <?php
> > >>> $time = time() + 10800;
> >
> > >> Why are you setting the timestamp for 3 hours in the future?
> > >> oAuth/twitter are very picky about the time being "close" to accurate,
> > >> being 3 hours off is definitely one potential problem with your code.
> > >> --
> > >> -ed costello
> >
> > > --
> > > Twitter developer documentation and resources:
> http://dev.twitter.com/doc
> > > API updates via Twitter:http://twitter.com/twitterapi
> > > Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> > > Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>
--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
http://groups.google.com/group/twitter-development-talk