[twitter-dev] Re: Invalid / expired Token

2010-10-03 Thread Rajendra Singh
Please?  No one sees a problem with the code?

On Sep 28, 7:20 pm, Rajendra Singh pub...@rajendra.ca wrote:
 Hi BJ,

 Here is the complete code:

 include_once oauth-php/library/OAuthStore.php;
 include_once oauth-php/library/OAuthRequester.php;

 // register athttp://twitter.com/oauth_clientsand fill these two
 define(TWITTER_CONSUMER_KEY, ); // I removed this for this post
 define(TWITTER_CONSUMER_SECRET, ); // I removed this for this post

 define(TWITTER_OAUTH_HOST,http://api.twitter.com;);
 define(TWITTER_REQUEST_TOKEN_URL, TWITTER_OAUTH_HOST . /oauth/
 request_token);
 define(TWITTER_AUTHORIZE_URL, TWITTER_OAUTH_HOST . /oauth/
 authorize);
 define(TWITTER_ACCESS_TOKEN_URL, TWITTER_OAUTH_HOST . /oauth/
 access_token);
 define(TWITTER_PUBLIC_TIMELINE_API, TWITTER_OAUTH_HOST . /statuses/
 public_timeline.json);
 define(TWITTER_UPDATE_STATUS_API, TWITTER_OAUTH_HOST . /1/statuses/
 update.json);

 define('OAUTH_TMP_DIR', function_exists('sys_get_temp_dir') ?
 sys_get_temp_dir() : realpath($_ENV[TMP]));

 // Twitter test
 $options = array('consumer_key' = TWITTER_CONSUMER_KEY,
 'consumer_secret' = TWITTER_CONSUMER_SECRET);
 OAuthStore::instance(2Leg, $options);

 try
    {
    // Obtain a request object for the request we want to make
    $request = new OAuthRequester(TWITTER_REQUEST_TOKEN_URL, POST);
    $result = $request-doRequest(0);
    parse_str($result['body'], $params);

    // now make the request.
    $request = new OAuthRequester(TWITTER_PUBLIC_TIMELINE_API, 'GET',
 $params);
    $result = $request-doRequest();

    $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
 array('status' = 'Test'));
    $result = $request-doRequest();
    }
 catch(OAuthException2 $e)
    {
    echo Exception:   . $e-getMessage() . \n;
    }
 ?

 On Sep 28, 6:16 pm, BJ Weschke bwesc...@btwtech.com wrote:

   Are you certain that you're using the accesstokenand secret received
  and not the requesttokenand secret?

  Rajendra Singh wrote:
   Help anyone?

   On Sep 6, 7:16 pm, Rajendra Singh rs.can...@gmail.com wrote:

   Hi Tom,

   Yes I did fill in those values correctly.

   On Sep 6, 5:44 pm, Tom van der Woerdt i...@tvdw.eu wrote:

   On 9/6/10 10:57 PM, Rajendra Singh wrote:

   Hello,

   I took the twoleggedtwitter.php example file and added the following
   two lines:

      $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
   status=Test);
      $result = $request-doRequest();

   However, when I execute it, I get:
   Exception:  Request failed with code401:  {request:/statuses/
   update.json,error:Invalid/expiredToken}

   Can someone help me?  What am I doing wrong?

   Did you fill in the consumertokenand secret? And the usertokenand
   secret?

   Tom

-- 
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-dev] Re: Invalid / expired Token

2010-09-28 Thread Rajendra Singh
Help anyone?

On Sep 6, 7:16 pm, Rajendra Singh rs.can...@gmail.com wrote:
 Hi Tom,

 Yes I did fill in those values correctly.

 On Sep 6, 5:44 pm, Tom van der Woerdt i...@tvdw.eu wrote:

  On 9/6/10 10:57 PM, Rajendra Singh wrote:

   Hello,

   I took the twoleggedtwitter.php example file and added the following
   two lines:

      $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
   status=Test);
      $result = $request-doRequest();

   However, when I execute it, I get:
   Exception:  Request failed with code401:  {request:/statuses/
   update.json,error:Invalid/expiredToken}

   Can someone help me?  What am I doing wrong?

  Did you fill in the consumertokenand secret? And the usertokenand
  secret?

  Tom

-- 
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-dev] Re: Invalid / expired Token

2010-09-28 Thread Rajendra Singh
Hi BJ,

Here is the complete code:

include_once oauth-php/library/OAuthStore.php;
include_once oauth-php/library/OAuthRequester.php;

// register at http://twitter.com/oauth_clients and fill these two
define(TWITTER_CONSUMER_KEY, ); // I removed this for this post
define(TWITTER_CONSUMER_SECRET, ); // I removed this for this post

define(TWITTER_OAUTH_HOST,http://api.twitter.com;);
define(TWITTER_REQUEST_TOKEN_URL, TWITTER_OAUTH_HOST . /oauth/
request_token);
define(TWITTER_AUTHORIZE_URL, TWITTER_OAUTH_HOST . /oauth/
authorize);
define(TWITTER_ACCESS_TOKEN_URL, TWITTER_OAUTH_HOST . /oauth/
access_token);
define(TWITTER_PUBLIC_TIMELINE_API, TWITTER_OAUTH_HOST . /statuses/
public_timeline.json);
define(TWITTER_UPDATE_STATUS_API, TWITTER_OAUTH_HOST . /1/statuses/
update.json);

define('OAUTH_TMP_DIR', function_exists('sys_get_temp_dir') ?
sys_get_temp_dir() : realpath($_ENV[TMP]));

// Twitter test
$options = array('consumer_key' = TWITTER_CONSUMER_KEY,
'consumer_secret' = TWITTER_CONSUMER_SECRET);
OAuthStore::instance(2Leg, $options);

try
   {
   // Obtain a request object for the request we want to make
   $request = new OAuthRequester(TWITTER_REQUEST_TOKEN_URL, POST);
   $result = $request-doRequest(0);
   parse_str($result['body'], $params);

   // now make the request.
   $request = new OAuthRequester(TWITTER_PUBLIC_TIMELINE_API, 'GET',
$params);
   $result = $request-doRequest();

   $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
array('status' = 'Test'));
   $result = $request-doRequest();
   }
catch(OAuthException2 $e)
   {
   echo Exception:   . $e-getMessage() . \n;
   }
?

On Sep 28, 6:16 pm, BJ Weschke bwesc...@btwtech.com wrote:
  Are you certain that you're using the access token and secret received
 and not the request token and secret?

 Rajendra Singh wrote:
  Help anyone?

  On Sep 6, 7:16 pm, Rajendra Singh rs.can...@gmail.com wrote:

  Hi Tom,

  Yes I did fill in those values correctly.

  On Sep 6, 5:44 pm, Tom van der Woerdt i...@tvdw.eu wrote:

  On 9/6/10 10:57 PM, Rajendra Singh wrote:

  Hello,

  I took the twoleggedtwitter.php example file and added the following
  two lines:

     $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
  status=Test);
     $result = $request-doRequest();

  However, when I execute it, I get:
  Exception:  Request failed with code401:  {request:/statuses/
  update.json,error:Invalid/expiredToken}

  Can someone help me?  What am I doing wrong?

  Did you fill in the consumertokenand secret? And the usertokenand
  secret?

  Tom

-- 
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-dev] Invalid / expired Token

2010-09-06 Thread Rajendra Singh
Hello,

I took the twoleggedtwitter.php example file and added the following
two lines:

   $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
status=Test);
   $result = $request-doRequest();

However, when I execute it, I get:
Exception:  Request failed with code 401:  {request:/statuses/
update.json,error:Invalid / expired Token}

Can someone help me?  What am I doing wrong?

-- 
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?hl=en


[twitter-dev] Re: Invalid / expired Token

2010-09-06 Thread Rajendra Singh
Hi Taylor,

Ok, I'm new to this OAUTH thing.  So if it doesn't support two-legged,
what do I use to authenticate?

Thanks.

On Sep 6, 6:12 pm, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 Twitter doesn't support any two-legged OAuth operations at this time.

 Taylor

 On Mon, Sep 6, 2010 at 2:44 PM, Tom van der Woerdt i...@tvdw.eu wrote:

  On 9/6/10 10:57 PM, Rajendra Singh wrote:
  Hello,

  I took the twoleggedtwitter.php example file and added the following
  two lines:

-- 
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?hl=en


[twitter-dev] Re: Invalid / expired Token

2010-09-06 Thread Rajendra Singh
Hi Tom,

Yes I did fill in those values correctly.

On Sep 6, 5:44 pm, Tom van der Woerdt i...@tvdw.eu wrote:
 On 9/6/10 10:57 PM, Rajendra Singh wrote:

  Hello,

  I took the twoleggedtwitter.php example file and added the following
  two lines:

     $request = new OAuthRequester(TWITTER_UPDATE_STATUS_API, 'POST',
  status=Test);
     $result = $request-doRequest();

  However, when I execute it, I get:
  Exception:  Request failed with code 401:  {request:/statuses/
  update.json,error:Invalid / expired Token}

  Can someone help me?  What am I doing wrong?

 Did you fill in the consumer token and secret? And the user token and
 secret?

 Tom

-- 
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?hl=en