Re: [twitter-dev] App Opportunity: OAuthcalypse

2010-05-01 Thread Lil Peck
OK guys, I am really tickled to have finally worked out a reasonable
understanding of how to use Abraham's Twitter Oauth for making
automated status updates. You're right, it is easy. And it's fun!
Thank you, thank you, Abraham, for making this available!!!

For anyone else who may be struggling with how to move from PHP
curl/basic authentication to Oauth, here's a quick tip:

Focus on Abraham's test.php file. Register callback.php as your app,
but load test.php in your browser. COMMENT OUT everything in the
script that doesn't interest you, because it will create/alter/delete
everything in your twitter account. (I had to comment stuff out
because I was unable to create a test account.) Edit config.php

At Twitter.com go to your apps listing and retrieve your consumer key
and consumer secret. Click on the My Access Token button to get your
access token and access secret.

I'll paste a very stripped down version of test.php below, in case
this is helpful to anyone. After edited with your keys and tokens,
then loaded in a browser, this will post status updates.

?php
/**
 * @file
 *
 */

/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');


session_start();
$_SESSION['access_token'] = 'YOURACCESSTOKENSTRING'; // store session data
session_start();
$_SESSION['oauth_token_secret'] = 'YOURACCESSTOKENSECRET'; // store session data



/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) ||
empty($_SESSION['access_token']['oauth_token']) ||
empty($_SESSION['access_token']['oauth_token_secret'])) {
header('Location: ./clearsessions.php');
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user tokens. */

function getConnectionWithAccessToken($oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$oauth_token, $oauth_token_secret);
  return $connection;
}


$connection = getConnectionWithAccessToken(YOURACCESSTOKENSTRING,
YOURACCESSTOKENSTRING);



/* Get logged in user to help with tests. */
$user = $connection-get('account/verify_credentials');

$active = TRUE;


function twitteroauth_row($method, $response, $http_code, $parameters = '') {

  if (!is_string($response)) {
$response = print_r($response, TRUE);
  }
  if (!is_string($parameters)) {
$parameters = print_r($parameters, TRUE);
  }


}



/* statuses/update */

$parameters = array('status' = 'YOUR STATUS UPDATE HERE MUST BE UNIQUE');
$status = $connection-post('statuses/update', $parameters);
twitteroauth_row('statuses/update', $status, $connection-http_code,
$parameters);


Re: [twitter-dev] App Opportunity: OAuthcalypse

2010-05-01 Thread Lil Peck
Emboldened by my success with Abraham's library, I moved along to
Scott Desapio's for Classic ASP! Succeeded in using it to post status
update via script w/o the Oauth dosey-do. Yay! Thanks very, very much
to Scott for doing all of this great work of clearing a path through
the wilderness for the rest of us. Those of you who are advanced like
Scott and Abraham may be unable to understand why it is that we mere
mortals have a difficult time adapting to Oauth for Twitter.

I'll share what I did to help others who may be as worried about Oauth
as I was. This is not a finished, polished app, it is merely an
exercise in simplifying everything to get the most basic results just
as a start. Here's a quick rundown:

After uploading Desapio's files
(http://scottdesapio.com/VBScriptOAuth/), search and replace
127.0.0.1 with your domain name, assuming you're using a hosting
company rather than your own PC.

To be able to make status updates via web script programmatically
without logging in, etc.,
go to this file oauth/cLibOAuth.RequestURL.asp

and look for
Dim strSecret : strSecret = _
m_strConsumerSecret_
m_strTokenSecret

Replace m_strConsumerSecret with the string that is your consumer secret.
Replace m_strTokenSecret with the string that is your oauth_token_secret.

Next go to update_status.asp and look for
' setup oAuth object

'''
objOAuth.ConsumerKey = OAUTH_EXAMPLE_CONSUMER_KEY
objOAuth.ConsumerSecret = OAUTH_EXAMPLE_CONSUMER_SECRET
objOAuth.EndPoint = TWITTER_OAUTH_URL_UPDATE_STATUS
objOAuth.Parameters.Add in_reply_to, strReplyTo
objOAuth.Parameters.Add in_reply_to_status_id, intReplyID
objOAuth.Parameters.Add oauth_token, Session(OAUTH_TOKEN)
objOAuth.Parameters.Add status, strStatus
objOAuth.RequestMethod = OAUTH_REQUEST_METHOD_POST



Replace as follows:
' setup oAuth object

'''
objOAuth.ConsumerKey = YOUR-CONSUMER-KEY-HERE
objOAuth.ConsumerSecret = YOUR-CONSUMER-SECRET-HERE
objOAuth.EndPoint = TWITTER_OAUTH_URL_UPDATE_STATUS
'objOAuth.Parameters.Add in_reply_to, strReplyTo COMMENT OUT UNLESS
THIS IS WHAT YOU WANT TO DO
'objOAuth.Parameters.Add in_reply_to_status_id, intReplyID COMMENT OUT
'objOAuth.Parameters.Add oauth_token, Session(OAUTH_TOKEN)
commented out and replaced as below with oauth token from twitter app
settings
objOAuth.Parameters.Add oauth_token, 
YOUR-APP-OAUTH-TOKEN-HERE
objOAuth.Parameters.Add oauth_token_secret,
YOUR-APP-OAUTH-TOKEN-SECRET-HERE
objOAuth.Parameters.Add status, strStatus
objOAuth.RequestMethod = OAUTH_REQUEST_METHOD_POST


Find the line that says
Dim strStatus : strStatus = Request.Form(post)
and replace as follows:
Dim strStatus : strStatus = YOUR UNIQUE STATUS UPDATE HERE

Comment out the following lines:
'Dim intReplyId : intReplyId = Request.Form(replyId)
'Dim strReplyTo : strReplyTo = Request.Form(replyTo)

Comment out:
'If objOAuth.LoggedIn Then

Comment out:
'Else
'Response.Status = RESPONSE_STATUS_403
'End If


[twitter-dev] Re: Properties and Methods of T object of @anywhere

2010-05-01 Thread MJ
Ok.

In that case then the easiest solution I can think of is to do
something similar to Facebook where session keys.  Right now I use the
session generated from the fb connect api to pass to the Server side
java libraries.

On Apr 28, 12:26 pm, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 Hi MJ,

 The access tokens used transparently behind the scenes in @Anywhere aren't
 compatible with the OAuth 1.0A access tokens Twitter uses in the standard
 API implementation. We're looking at creative ways to bridge the gap but
 won't have an easy solution for this for a bit.

 Taylor Singletary
 Developer Advocate, Twitterhttp://twitter.com/episod

 On Wed, Apr 28, 2010 at 9:18 AM, MJ lor...@gmail.com wrote:
  Don't mean the credentials (password) but if a user authorizes my app
  to for example post tweets to their account via @anywhere  will my
  server side libraries (using JTwitter) have the same permissions
  provided that they are using the same API Key and Secret Key?

  On Apr 28, 4:06 am, glenn gillen gl...@rubypond.com wrote:
   On Apr 28, 12:06 am, MJ lor...@gmail.com wrote:

Also I am using @anywhere to login but I also have some server side
code with java.  Is there a way that I can pass the credentials of the
@anywhere logged in user to the server side code?  Or does that happen
automatically (once someone authorizes the Twitter application via
@anywhere a server side library with the same apikey and secretkey is
authorized).

   I doubt you'll have access to the credentials, as that would mean
   you'd
   have login credentials for any twitter user that hit your page which
   wouldn't
   be what end users would expect.
   --
   Glennhttp://glenngillen.com/


[twitter-dev] @Anywhere and Usernames (15+ chars) question

2010-05-01 Thread Arnaud Meunier
Enjoying a free Saturday afternoon, I was playing with @Anywhere and I
noticed something quite strange related to Twitter Usernames. The
@Anywhere documentation says A Twitter screen name is an '@' symbol
followed by 1 to 20 alphanumeric characters, including underscores

The problem is… I thought a Twitter Username could not exceed 15
characters? Try to create / change your username to something longer
than 15 chars: you can’t. But @Anywhere JS is still trying to add
Hovercards to these strings (@15+ chars) that cannot match any Twitter
User.

Is it a bug? A confusion with “Real Names”? A necessity because of a
previous policy (can’t remember if you could create 15+ chars
Usernames in the past)? Or do you plan to allow usernames longer than
15 chars in a near future?

Was just wondering :)


[twitter-dev] Re: About update limits

2010-05-01 Thread akaii
Pardon, I'd just like to follow-up on my question in case it was
missed. I'm fine with not knowing what the precise sub-limits are, but
can I at least ask why the specifics aren't made public? I just need
to be able to respond with something in case our client asks... It'll
be easier for them to swallow the idea that it's a twitter policy if
we can explain the reason why the policy exists.

On Apr 29, 4:45 pm, Brian Sutorius bsutor...@twitter.com wrote:
 To clarify, statuses/update is not affected by rate-limit whitelisting
 as it's a POST call and we don't maintain a separate whitelist for
 boosting the daily tweet limit above 1000. While we do not give out
 the specifics around the sub-limits, they *are* administered on a
 per-account basis and if you stay around your approximation of 20
 tweets per half-hour you should be fine.

 Brian Sutorius

 On Apr 29, 6:07 am, Raffi Krikorian ra...@twitter.com wrote:

  the numbers are roughly broken up over the day.  and the limit applies to an
  account.

  and yes - there is a whitelisting for status/updates -- please e-mail
  a...@twitter to ask for it.

  On Thu, Apr 29, 2010 at 5:26 AM, akaii chibiak...@gmail.com wrote:
   This is what the FAQ has to say about status update limits:

   Updates: 1,000 per day. The daily update limit is further broken down
   into smaller limits for semi-hourly intervals. Retweets are counted as
   updates.

   I'm a little unclear as to what exactly is meant by further broken
   down into smaller limits for semi-hourly intervals. Is the 1000 per
   day limit divided evenly between the 48 half hours each day (around 20
   or so tweets per half an hour?).

   Also, I'm assuming this limit applies to each unique account?

   Is this limit absolutely fixed? Or is there some equivalent to
   whitelisting for status/update limits as well?

   Thanks...

  --
  Raffi Krikorian
  Twitter Platform Teamhttp://twitter.com/raffi


[twitter-dev] to display tweets in my website using ASP.NET

2010-05-01 Thread krunal shah
i want to make search engine of twitter using ASP.NET

if someone search like #india, it should display most 10 recently
tweets related to india.

if someone search according to location, then it sholud display the
tweets related to that location

if someone search for positive emotion or negative emotion, then it
should display tweets related to that postive or negative emotion.

thanks in advance

Regards,
Krunal Shah



[twitter-dev] Re: to display tweets in my website using ASP.NET

2010-05-01 Thread glenn gillen
On May 1, 10:14 am, krunal shah krunalshah2...@gmail.com wrote:
 i want to make search engine of twitter using ASP.NET

 snip

Krunal,

It sounds like you want to build http://search.twitter.com/advanced ?
So two questions from me:

- What's the purpose? Just an educational exercise? As a product it
seems to be already available and in widespread use.
- Did you have a question to ask?
--
Glenn Gillen
http://glenngillen.com/


Re: [twitter-dev] Re: About update limits

2010-05-01 Thread John Kalucki
As a general rule, whenever Twitter is cagey about limits, it's due to
anti-abuse reasons. It's not in the interest of fighting abuse, and
thus the community as a whole, to talk about certain limits. Also,
some limits are subject to continuous or unannounced adjustment, so
they're not practical to make public. This issue has been aired
before, at length, on this list. Please save your emails, as there's
little chance that rhetoric will persuade the abuse people to go
against data that show that the current policy is, unfortunately, the
best policy.

-John Kalucki
http://twitter.com/jkalucki
Infrastructure, Twitter Inc.


On Sat, May 1, 2010 at 7:33 AM, akaii chibiak...@gmail.com wrote:
 Pardon, I'd just like to follow-up on my question in case it was
 missed. I'm fine with not knowing what the precise sub-limits are, but
 can I at least ask why the specifics aren't made public? I just need
 to be able to respond with something in case our client asks... It'll
 be easier for them to swallow the idea that it's a twitter policy if
 we can explain the reason why the policy exists.

 On Apr 29, 4:45 pm, Brian Sutorius bsutor...@twitter.com wrote:
 To clarify, statuses/update is not affected by rate-limit whitelisting
 as it's a POST call and we don't maintain a separate whitelist for
 boosting the daily tweet limit above 1000. While we do not give out
 the specifics around the sub-limits, they *are* administered on a
 per-account basis and if you stay around your approximation of 20
 tweets per half-hour you should be fine.

 Brian Sutorius

 On Apr 29, 6:07 am, Raffi Krikorian ra...@twitter.com wrote:

  the numbers are roughly broken up over the day.  and the limit applies to 
  an
  account.

  and yes - there is a whitelisting for status/updates -- please e-mail
  a...@twitter to ask for it.

  On Thu, Apr 29, 2010 at 5:26 AM, akaii chibiak...@gmail.com wrote:
   This is what the FAQ has to say about status update limits:

   Updates: 1,000 per day. The daily update limit is further broken down
   into smaller limits for semi-hourly intervals. Retweets are counted as
   updates.

   I'm a little unclear as to what exactly is meant by further broken
   down into smaller limits for semi-hourly intervals. Is the 1000 per
   day limit divided evenly between the 48 half hours each day (around 20
   or so tweets per half an hour?).

   Also, I'm assuming this limit applies to each unique account?

   Is this limit absolutely fixed? Or is there some equivalent to
   whitelisting for status/update limits as well?

   Thanks...

  --
  Raffi Krikorian
  Twitter Platform Teamhttp://twitter.com/raffi