[twitter-dev] Correct way to handle statues id using PHP with twitter retweet api

2011-02-25 Thread tianye22
Hi All

I am trying to implement the retweet function using the statuses/
retweet/ api. I have encountered a very frustrating problem:

If I am passing the status id inside a variable, it does not work
Not working:

  $parameters = array();
  $url = 'statuses/retweet/'.$sid;
  $rtstring = $twitter-oAuthRequest($url, 'POST', $parameters);

However if I hard-coded the statues id inside the url, it works:

Working:
  $parameters = array();
  $url = 'statuses/retweet/41203690924818432';
  $rtstring = $twitter-oAuthRequest($url, 'POST', $parameters);

I have verified that the $sid does contain the correct id, I am really
confused here. Is there anything special in PHP of handing string and
integer? I am a newbiee to PHP.

Thanks for your help!

-- 
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


Re: [twitter-dev] Correct way to handle statues id using PHP with twitter retweet api

2011-02-25 Thread Abraham Williams
Some PHP installs have issues with ints the size of newer status_ids. Try
using `id_str` from the status object instead of `id`.

Also if you are using the latest version of TwitterOAuth I recommend
constructing your requests like this:

$rtstring = $twitter-post($url);

If you have paramaters pass them as the second argument.

Abraham
-
Abraham Williams | Hacker Advocate | abrah.am
http://abrah.amJust launched from Answerly http://answerly.com:
InboxQhttp://inboxq.comfor Chrome
@abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.



On Fri, Feb 25, 2011 at 10:43, tianye22 ye.henry.t...@gmail.com wrote:

 Hi All

 I am trying to implement the retweet function using the statuses/
 retweet/ api. I have encountered a very frustrating problem:

 If I am passing the status id inside a variable, it does not work
 Not working:

  $parameters = array();
  $url = 'statuses/retweet/'.$sid;
  $rtstring = $twitter-oAuthRequest($url, 'POST', $parameters);

 However if I hard-coded the statues id inside the url, it works:

 Working:
  $parameters = array();
  $url = 'statuses/retweet/41203690924818432';
  $rtstring = $twitter-oAuthRequest($url, 'POST', $parameters);

 I have verified that the $sid does contain the correct id, I am really
 confused here. Is there anything special in PHP of handing string and
 integer? I am a newbiee to PHP.

 Thanks for your help!

 --
 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