[twitter-dev] Twiiter Latest 20 Tweets requires authorization

2011-03-22 Thread deepak
Hi,

We are displaying twitter latest 20 tweets to me on my website.
but this api call requires authorization and we have not found any
code for authorization using php.

we have read the full documentation of oauth on dev.twitter.com but
still when we access
http://api.twitter.com/1/statuses/retweets_to_me.json

it shows error message {request:\/1\/statuses\/retweets_of_me.json?
count=100page=1trim_user=trueinclude_entities=true,error:Could
not authenticate you.}.

Please provide authorization code for api call.

Please help me to solve this issue.


Thanks

-- 
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] Need to integrate Twitter Authentication in my web application

2011-03-22 Thread Manish Sadhwani
Ok, Thanks


On Tue, Mar 22, 2011 at 12:44 PM, Scott Wilcox sc...@dor.ky wrote:

 Again, there is no methods in the API that will give you an email address
 of a user.

 Scott.

 On 22 Mar 2011, at 06:10, Manish Sadhwani wrote:

  Hello
 
  Thanks for quick response.  I think i was not able to explain u
  clearly what we need.
 
  I need to integrate SSO authentication like Google and Facebook). I
  dont need user's email address.
 
  Our requirement is we provide an icon for twitter login.. User comes
  to our site, and clicks on twitter link, user goes to twitter and if
  successful logged in, with his permission we can get his email. So
  that we can allow user to login (if that email is in our database) or
  prompt for registration(if no email of that user in our db) in our web
  application.
 
 
  For example you can visit http://www.cloudspokes.com. We have
  integrated google and facebook authentication. We need to integrate
  twitter login like facebook. There is a link named Login where u can
  find facebook link.
 
 
  Thanks in advance
 
  Regards
  Manish Sadhwani
 
  - Hide quoted text -
 
 
  On Mon, Mar 21, 2011 at 9:18 PM, hax0rsteve hax0rc...@btinternet.com
  wrote:
 
 
  Hi Manish,
 
  As far as I know, the Twitter API does not provide any method to get
  the user's email, and as far as first and last name you will have to
  rely on the name field of the user entity.  This may or (more
  likely)
  may not contain the information you are looking for.
 
  You can see a list of the fields contained in a user entity at :
  http://dev.twitter.com/doc/get/users/lookup
 
  Basically, if you need to those data, you are going to have the user
  for them yourself in your application.
 
  hax0rsteve
 
 
 
 
  On 21 Mar 2011, at 09:34, Manish Sadhwani wrote:
 
  Hi
 
  I am having a web application in .net (3.5) and SQL Server. I need to
  add twitter authentication in my application in which, user is
  authenticated at twitter with his username and password, and if
  authenticated, i will be able to get email, firstname and lastname of
  that twitter user.
 
  I have implemented facebook and google authentication (openId) in my
  web application
 
  Regards
  Manish

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




-- 
Manish Sadhwani
+919928070709

-- 
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: Twiiter Latest 20 Tweets requires authorization

2011-03-22 Thread deepak
Hi
 i am using the below code
but it is still showing me error for authentication
but user credential call is working fine.

  define('CONSUMER_KEY', $param['CONSUMER_KEY']);
define('CONSUMER_SECRET',$param['CONSUMER_SECRET']);
define('OAUTH_CALLBACK', $param['OAUTH_CALLBACK']);


if(!isset($_SESSION['oauth_token']) ||
empty($_SESSION['oauth_token'])){
/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, 
CONSUMER_SECRET);

/* Get temporary credentials. */
$request_token = 
$connection-getRequestToken(OAUTH_CALLBACK);

/* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token = 
$request_token['oauth_token'];
$_SESSION['oauth_token_secret'] =
$request_token['oauth_token_secret'];

/* If last connection failed don't display 
authorization link. */
switch ($connection-http_code) {
  case 200:
/* Build authorize URL and redirect user to 
Twitter. */
$url = $connection-getAuthorizeURL($token);
header('Location: ' . $url);

break;
  default:
/* Show notification if something went wrong. */
echo 'Could not connect to Twitter. Refresh the 
page or try again
later.';
}
}


//
/* Create TwitteroAuth object with app key/secret and token key/
secret from default phase */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

/* Request access tokens from twitter */
$access_token = $connection-
getAccessToken($_REQUEST['oauth_verifier']);

/* Save the access tokens. Normally these would be saved in a
database for future use. */
$_SESSION['access_token'] = $access_token;



/* If HTTP response is 200 continue otherwise send to connect 
page
to retry */
if (200 == $connection-http_code) {

/* The user has been verified and the access tokens can 
be saved
for future use */
$_SESSION['status'] = 'verified';

/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user 
tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, 
CONSUMER_SECRET,
$access_token['oauth_token'], $access_token['oauth_token_secret']);

/* If method is set change API call made. Test is 
called by
default. */
$content = 
$connection-get('account/verify_credentials');

// Twitter re tweet api call
   $api = 'http://api.twitter.com/1/statuses/
retweets_of_me.json';
// request twitter follower api
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content= curl_exec($ch);
curl_close($ch);

 print_r($content);

session_destroy();

return $content;

} else {

 /* Save HTTP status for error dialog on connnect 
page.*/
if($this-debug){
echo $connection-http_code. ' invalid response 
code. br/';
}
return false;
}

On Mar 22, 1:18 pm, CWorster cwors...@schlimmer.com wrote:
 Here are some OAuth Libraries in 
 PHPhttp://dev.twitter.com/pages/oauth_libraries#php

 2011/3/22 deepak deepak.d...@gmail.com:

  Hi,

  We are displaying twitter latest 20 tweets to me on my website.
  but this api call requires authorization and we have not found any
  code for authorization using php.

  we have read the full documentation of oauth on dev.twitter.com but
  still when we access
 http://api.twitter.com/1/statuses/retweets_to_me.json

  it shows error message {request:\/1\/statuses\/retweets_of_me.json?
  count=100page=1trim_user=trueinclude_entities=true,error:Could
  not authenticate you.}.

  Please provide authorization code for api call.

  Please help me to solve this issue.

  Thanks

  --
  Twitter developer documentation and resources:http://dev.twitter.com/doc
  API updates 

[twitter-dev] Re: Flaw in Twitter Widget code - Note to Twitter Developers!

2011-03-22 Thread npwhiteley
I think it's also worth noting that the document.write call in the
current script also prevents any containing page from being delivered
as application/xhtml+xml.

I also modified the code to use the script's src attribute to get a
reference to it's parent container and then used appendChild in place
of the document.write call. Not the most elegent solution but it shows
that there are a number of alternatives to document.write in this
case.


On Mar 19, 9:36 pm, BuffLaser2000 tmo...@gmail.com wrote:
 In this code:http://twitter.com/javascripts/widgets/widget.js

 You are using document.write() to create the widget element. Bad bad
 bad. Any AJAX site that tries to init the widget after the page loads
 will have the entire page overwritten by the widget.

 W3C even has this to say about document.write():
 Note: Try to avoid using document.write() in real life JavaScript
 code. The entire HTML page will be overwritten if document.write() is
 used inside a function, or after the page is loaded. However,
 document.write() is an easy way to demonstrate JavaScript output in a
 tutorial.

 So, I downloaded the JS file and modified TWTR.Widget to take a
 container element name as part of the options object. If
 set, .innerHTML is used on the container element instead of
 document.write.

 This simple fix will make your widgets compatible with Web 2.0 sites.

 Thanks for listening.

-- 
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] oAuth Tweet of me api call Could not authenticate

2011-03-22 Thread deepak
Hi,

we are using the below code to make api call
The api call to fetch tweet is not working but api call for credential
is working fine.

It is showing the below error

{request:\/1\/statuses\/retweets_of_me.json?,error:Could not
authenticate you.}


Please see the below code


define('CONSUMER_KEY', $param['CONSUMER_KEY']);
define('CONSUMER_SECRET',$param['CONSUMER_SECRET']);
define('OAUTH_CALLBACK', $param['OAUTH_CALLBACK']);


if(!isset($_SESSION['oauth_token']) ||
empty($_SESSION['oauth_token'])){
/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, 
CONSUMER_SECRET);

/* Get temporary credentials. */
$request_token = 
$connection-getRequestToken(OAUTH_CALLBACK);

/* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token = 
$request_token['oauth_token'];
$_SESSION['oauth_token_secret'] =
$request_token['oauth_token_secret'];

/* If last connection failed don't display 
authorization link. */
switch ($connection-http_code) {
  case 200:
/* Build authorize URL and redirect user to 
Twitter. */
$url = $connection-getAuthorizeURL($token);
header('Location: ' . $url);

break;
  default:
/* Show notification if something went wrong. */
echo 'Could not connect to Twitter. Refresh the 
page or try again
later.';
}
}


//
/* Create TwitteroAuth object with app key/secret and token key/
secret from default phase */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

/* Request access tokens from twitter */
$access_token = $connection-
getAccessToken($_REQUEST['oauth_verifier']);

/* Save the access tokens. Normally these would be saved in a
database for future use. */
$_SESSION['access_token'] = $access_token;



/* If HTTP response is 200 continue otherwise send to connect 
page
to retry */
if (200 == $connection-http_code) {

/* The user has been verified and the access tokens can 
be saved
for future use */
$_SESSION['status'] = 'verified';

/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user 
tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, 
CONSUMER_SECRET,
$access_token['oauth_token'], $access_token['oauth_token_secret']);

/* If method is set change API call made. Test is 
called by
default. */
$content = 
$connection-get('account/verify_credentials');

 $api = 'http://api.twitter.com/1/statuses/
retweets_of_me.json';

// twitter follower api
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content= curl_exec($ch);
curl_close($ch);
   print_r($content);
session_destroy();

return $content;

} else {

 /* Save HTTP status for error dialog on connnect 
page.*/
if($this-debug){
echo $connection-http_code. ' invalid response 
code. br/';
}
return false;
}

-- 
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] Tweet button over HTTPS

2011-03-22 Thread felipe.lavin
I recently set my Twitter account to use HTTPS only, but when using
the tweet button I always get the plain HTTP version... is it
scheduled for any time soon for the tweet button to recognize this
setting?

-- 
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] Search API: retrieve the number of times a particular URL was tweeted?

2011-03-22 Thread doug
The Facebook API has a FQL query that allows one to retrieve the
number of Likes or Shares a particular URL got.

I can certainly find a way to use the Twitter Search API to retrieve
the raw statuses that mention a particular URL... but it seems like
overkill when all I would like is the count... the number of statuses
that mention that URL.

Is there a way to simply retrieve _just_ the count of URL mentions?

Thanks, Doug



-- 
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] Search API: retrieve the number of times a particular URL was tweeted?

2011-03-22 Thread Taylor Singletary
Hi Doug,

We don't have a search result counting API available at this time. One
approach would be to prepare ahead of time and use the Streaming API's track
filter on the URL you're interested in, keeping the stream open and counting
tweets featuring your URL as it spreads on Twitter.
http://dev.twitter.com/pages/streaming_api_methods#track

Taylor

@episod http://twitter.com/episod - Taylor Singletary - Twitter Developer
Advocate


On Tue, Mar 22, 2011 at 7:13 AM, doug douglas.r...@gmail.com wrote:

 The Facebook API has a FQL query that allows one to retrieve the
 number of Likes or Shares a particular URL got.

 I can certainly find a way to use the Twitter Search API to retrieve
 the raw statuses that mention a particular URL... but it seems like
 overkill when all I would like is the count... the number of statuses
 that mention that URL.

 Is there a way to simply retrieve _just_ the count of URL mentions?

 Thanks, Doug



 --
 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-dev] Re: Search API: retrieve the number of times a particular URL was tweeted?

2011-03-22 Thread doug
Got it.  Thanks, Taylor.

On Mar 22, 11:16 am, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 Hi Doug,

 We don't have a search result counting API available at this time. One
 approach would be to prepare ahead of time and use the Streaming API's track
 filter on the URL you're interested in, keeping the stream open and counting
 tweets featuring your URL as it spreads on 
 Twitter.http://dev.twitter.com/pages/streaming_api_methods#track

 Taylor

 @episod http://twitter.com/episod - Taylor Singletary - Twitter Developer
 Advocate

 On Tue, Mar 22, 2011 at 7:13 AM, doug douglas.r...@gmail.com wrote:
  The Facebook API has a FQL query that allows one to retrieve the
  number of Likes or Shares a particular URL got.

  I can certainly find a way to use the Twitter Search API to retrieve
  the raw statuses that mention a particular URL... but it seems like
  overkill when all I would like is the count... the number of statuses
  that mention that URL.

  Is there a way to simply retrieve _just_ the count of URL mentions?

  Thanks, Doug

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


Re: [twitter-dev] Search API: retrieve the number of times a particular URL was tweeted?

2011-03-22 Thread Stuart Dallas
Hi Doug,

Tweetmeme have an API that can give you this info.

http://help.tweetmeme.com/2009/04/07/api-documentation/

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

On Tuesday, 22 March 2011 at 14:13, doug wrote: 
 The Facebook API has a FQL query that allows one to retrieve the
 number of Likes or Shares a particular URL got.
 
 I can certainly find a way to use the Twitter Search API to retrieve
 the raw statuses that mention a particular URL... but it seems like
 overkill when all I would like is the count... the number of statuses
 that mention that URL.
 
 Is there a way to simply retrieve _just_ the count of URL mentions?
 
 Thanks, Doug
 
 
 
 -- 
 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-dev] Response Time

2011-03-22 Thread Ankit Nautiyal
Dear Team,

We are facing issues with response time of APIs.


-- 
Regards
Ankit Nautiyal

-- 
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] Tweet button over HTTPS

2011-03-22 Thread Arnaud Meunier
Hey Felipe,

If you checked the Always use HTTPS box in your Account settings, the
Share this on Twitter popup (that appears when you actually click the
button) will be served over SSL.

However, the button itself doesn't work over SSL yet (cf:
http://dev.twitter.com/pages/tweet_button_faq#https). We're working on it.

Arnaud / @rno http://twitter.com/rno



On Tue, Mar 22, 2011 at 5:43 AM, felipe.lavin felipe.la...@gmail.comwrote:

 I recently set my Twitter account to use HTTPS only, but when using
 the tweet button I always get the plain HTTP version... is it
 scheduled for any time soon for the tweet button to recognize this
 setting?

 --
 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-dev] Bad Word Filter

2011-03-22 Thread Alex Beckman
Hey All,

We have a client that wants to use a twitter filter on their site, but
wants to filter out about 100 or so bad words (kids content). We have
been using negations but when you click join the conversations they
all show up with a -bad word at the top of the page.

Does anyone have advice on how to create a CUSTOMIZED twitter widget
that has bad word filtering and doesn't expose the filter upon click?
We tried TidyTweet, and could not achieve the needed level of custom
look and feel.

Thanks!
Alex

-- 
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: 401 unauthorized

2011-03-22 Thread Craig Walls
I'm seeing the same thing that Ninjamonk reported on Mar 20 at
10:10am. That is, if I pause before asking for the access token, it
will work. The only difference is that Ninjamonk said he paused for 10
seconds...I found that I have to pause for at least 15 seconds. I also
discovered that just waiting 15 seconds before pressing the accept
button has the same effect.

I also discovered that if I *don't* pause and it fails that I can re-
issue the same request for the access token again (recalculating the
signature with a new timestamp and nonce) and it will work the 2nd
time.

And, much like everyone else has reported, this is in code that has
been working well for quite awhile, hasn't changed, and is only very
recently started to exhibit this behavior.

FWIW, I also debugged down to the base string (just before it is
encrypted) to see if there's any difference between the base string of
a working request and one that doesn't work. Aside from the nonce and
timestamp, there's no difference at all.

To repeat: It *always* works if there's a 15 second or more delay
between obtaining the request token and trying to get the access
token. And it *always* fails the first time if there is no delay, but
works the 2nd time.

-- 
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: 401 unauthorized

2011-03-22 Thread Craig Walls

Okay, more information for you to consider...
 - I am using HTTPS in the requests
 - I am using the api subdomain in the OAuth requests

First, the failed attempt:

I fetched the request token:
   oauth_timestamp: 1300825895
   Date header in response: [Tue, 22 Mar 2011 20:31:36 GMT]
I then authorized and exchanged for the access token and it failed
with a 401:
   oauth_timestamp: 1300825900
   Date header in response: [Tue, 22 Mar 2011 20:31:40 GMT]
My code immediately tried again after the failure and it worked the
2nd time:
   oauth_timestamp: 1300825900
   Date header in response: [Tue, 22 Mar 2011 20:31:40 GMT]

Notice that there was only a 4 second time lapse between obtaining the
request token and exchanging for the access token. I then tried again
with a ~15 second delay:

I fetched the request token:
   oauth_timestamp: 1300825933
   Date header in response: [Tue, 22 Mar 2011 20:32:13 GMT]
I then waited at the authorization screen for over 15 seconds before
clicking accept...then tried to exchange for the access token...and it
worked:
   oauth_timestamp: 1300825976
   Date header in response: [Tue, 22 Mar 2011 20:32:56 GMT]

So, again in summary: If there is less than 15 seconds of delay
between obtaining the request token and the access token, it always
fails. If there is a 15 second delay, it always works. And, when it
fails, trying to exchange the request token and verifier a 2nd time
will always work.

On Mar 21, 9:04 am, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 If you're experiencing this issue, can you please provide these additional
 details:
   * are the OAuth URLs you are using http or https?
   * do your OAuth URLs contain the api subdomain? (you really should be if
 you aren't)
   * what OAuth library (if any) are you using to sign your requests?
   * If you're observing the response HTTP headers on failed requests, what
 server time is presented in the Date HTTP header? What is your OAuth
 timestamp?

 Thanks!

 @episod http://twitter.com/episod - Taylor Singletary - Twitter Developer
 Advocate

 On Mon, Mar 21, 2011 at 6:24 AM, Taylor Singletary 

 taylorsinglet...@twitter.com wrote:
  Thanks everyone for the detailed information in these reports; they'll help
  a lot while we track down the issue. Will update this thread when we know
  more.

  @episod http://twitter.com/episod - Taylor Singletary - Twitter
  Developer Advocate

  On Mon, Mar 21, 2011 at 6:03 AM, Tatham Oddie tat...@oddie.com.au wrote:

  Please go and star this issue:
 http://code.google.com/p/twitter-api/issues/detail?id=2118

  On Mar 19, 11:47 pm, Trevor Dean trevord...@gmail.com wrote:
   Is anyone else experiencing any 401 errors all of a sudden?  I was doing
   some testing this morning and was logging in fine using twitter and then
  10
   min later I started getting 401 unauthorized errors.

   Thanks,

   Trevor

  --
  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-dev] Re: 401 unauthorized

2011-03-22 Thread kraigh
I am seeing exact same behavior (only works with delay) and am using
Twitterizer Library.  I am new to Twitter and Twitterizer libarary and
though I was doing something wrong.  Clearly not.  Thanks for posting
this.

On Mar 22, 1:42 pm, Craig Walls hab...@gmail.com wrote:
 Okay, more information for you to consider...
  - I am using HTTPS in the requests
  - I am using the api subdomain in the OAuth requests

 First, the failed attempt:

 I fetched the request token:
    oauth_timestamp: 1300825895
    Date header in response: [Tue, 22 Mar 2011 20:31:36 GMT]
 I then authorized and exchanged for the access token and it failed
 with a 401:
    oauth_timestamp: 1300825900
    Date header in response: [Tue, 22 Mar 2011 20:31:40 GMT]
 My code immediately tried again after the failure and it worked the
 2nd time:
    oauth_timestamp: 1300825900
    Date header in response: [Tue, 22 Mar 2011 20:31:40 GMT]

 Notice that there was only a 4 second time lapse between obtaining the
 request token and exchanging for the access token. I then tried again
 with a ~15 second delay:

 I fetched the request token:
    oauth_timestamp: 1300825933
    Date header in response: [Tue, 22 Mar 2011 20:32:13 GMT]
 I then waited at the authorization screen for over 15 seconds before
 clicking accept...then tried to exchange for the access token...and it
 worked:
    oauth_timestamp: 1300825976
    Date header in response: [Tue, 22 Mar 2011 20:32:56 GMT]

 So, again in summary: If there is less than 15 seconds of delay
 between obtaining the request token and the access token, it always
 fails. If there is a 15 second delay, it always works. And, when it
 fails, trying to exchange the request token and verifier a 2nd time
 will always work.

 On Mar 21, 9:04 am, Taylor Singletary taylorsinglet...@twitter.com
 wrote:

  If you're experiencing this issue, can you please provide these additional
  details:
    * are the OAuth URLs you are using http or https?
    * do your OAuth URLs contain the api subdomain? (you really should be if
  you aren't)
    * what OAuth library (if any) are you using to sign your requests?
    * If you're observing the response HTTP headers on failed requests, what
  server time is presented in the Date HTTP header? What is your OAuth
  timestamp?

  Thanks!

  @episod http://twitter.com/episod - Taylor Singletary - Twitter Developer
  Advocate

  On Mon, Mar 21, 2011 at 6:24 AM, Taylor Singletary 

  taylorsinglet...@twitter.com wrote:
   Thanks everyone for the detailed information in these reports; they'll 
   help
   a lot while we track down the issue. Will update this thread when we know
   more.

   @episod http://twitter.com/episod - Taylor Singletary - Twitter
   Developer Advocate

   On Mon, Mar 21, 2011 at 6:03 AM, Tatham Oddie tat...@oddie.com.au wrote:

   Please go and star this issue:
  http://code.google.com/p/twitter-api/issues/detail?id=2118

   On Mar 19, 11:47 pm, Trevor Dean trevord...@gmail.com wrote:
Is anyone else experiencing any 401 errors all of a sudden?  I was 
doing
some testing this morning and was logging in fine using twitter and 
then
   10
min later I started getting 401 unauthorized errors.

Thanks,

Trevor

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


Re: [twitter-dev] Re: Search API rate limit change?

2011-03-22 Thread Hayes Davis
I just wanted to add to this. The 420s have let up for the most part and I'm
no longer seeing rate limiting behavior significantly different from the
norm.

I've noticed that many result pages are coming back with empty results but
if I re-request the same page (after a couple second delay), I can often get
results for that page. These are for queries with very low tweet velocity,
so it's not like these are new results coming in. Is this related to
http://status.twitter.com/post/3785043723/slow-searches ?

Thanks.

Hayes

On Mon, Mar 21, 2011 at 6:13 PM, Matt Harris thematthar...@twitter.comwrote:

 In many cases we are forced to change the rate limits in response to
 a significant increase in requests, which means it isn't always possible to
 give advanced notice of rate limit changes.

 For some of you it sounds like your code that handles rate limiting didn't
 react appropriately. When receiving a 420 response we recommend you stop
 making requests and then after the retry-after, slowly build up the number
 of requests you make. Put another way it isn't a good idea to make requests
 to the API at the velocity that caused the 420 response before.

 As always, the rate limits are there to ensure the system is responsive and
 available to as many users as possible. This means it is necessary to reduce
 the number of queries you can make without notice.

 The best place to stay informed about issues like this are posted through
 @twitterapi and published on the Twitter status blog:
 http://status.twitter.com/post/3785043723/slow-searches

 Best,
 @themattharris
 Developer Advocate, Twitter
 http://twitter.com/themattharris



 On Mon, Mar 21, 2011 at 7:41 AM, Colin Surprenant 
 colin.surpren...@gmail.com wrote:

 By adjusting the rate limits to reduce the stress on your search api
 without notice you have significantly increased the stress level on
 our end :P Seriously, advanced notice of the situation would have been
 welcome.

 In particular what created lots of confusion on our end is that even
 after pausing for the specified retry_after delay we would
 immediately get repeated 420s at which point we started to assume our
 IPs were banned (which also contributed to increase the stress level).

 Colin

 On Mar 21, 9:12 am, Jeffrey Greenberg jeffreygreenb...@gmail.com
 wrote:
  Taylor,
  Yeah this was definitely NOT good.In the past, when there is a
  service disruption, your api group would post something on your status
  page and tweet about it... Instead, I'm finding out about this from my
  customers...
 
  Did y'all tweet about this or present this somewhere where I could find
 it?
 
  Jeffrey
  Tweettronics.com
 
  On Sun, Mar 20, 2011 at 3:14 PM, Waldron Faulkner
 
 
 
 
 
 
 
  waldronfaulk...@gmail.com wrote:
   Without prior notice, I can understand (circumstances), but without
   any kind of subsequent announcement?? Means we have to discover issues
   ourselves, verify that they're Twitter related (and not internal),
   then search around for existing discussion on the topic. Saves us a
   lot of time and headaches if Twitter would just announce stuff like
   this.
 
   On Mar 18, 2:51 pm, Taylor Singletary taylorsinglet...@twitter.com
   wrote:
   We're working to reinstate the usual limits on the Search API; due to
 the
   impact of the Japanese earthquake and resultant query increase
 against the
   Search API, some rates were adjusted to cope  better serve queries.
 Will
   give everyone an update with the various limits are adjusted.
 
   @episod http://twitter.com/episod - Taylor Singletary - Twitter
 Developer
   Advocate
 
   On Fri, Mar 18, 2011 at 11:39 AM, Hayes Davis ha...@appozite.com
 wrote:
Hi,
 
We're seeing this as well starting at approximately the same time
 as
described. We've backed off on searching but are seeing no
 reduction in the
sporadic limiting. It also appears that the amount of results
 returned on
successful queries is severely limited. Some queries that often
 have 1500
tweets from the last 5 days are returning far fewer results from
 only the
last day.
 
Could we get an update on this?
 
Hayes
 
On Fri, Mar 18, 2011 at 10:13 AM, Eric e...@telvetto.com wrote:
 
We're also seeing 400s on different boxes across different IP
addresses with different queries (so it does not appear to be
 server
or query specific). These began on all boxes at 2 a.m. UTC. We've
backed off on both number and rate of queries with no effect.
 We've
also noticed an increase in sporadic fail whales via browser based
search (atom and html) from personal accounts, although we haven't
attempted to quantify it.
 
On Mar 18, 7:40 am, zaver zave...@hotmail.com wrote:
 Hello,
 
 After the latest performance issues with the search api i have
 been
 seeing a lot of 420 response codes.From yesterday until now i
 only get
 420 responses on the every search i make. In particular, i
 search for
 about 

[twitter-dev] Search API: Secure profile image URLs

2011-03-22 Thread Jacob
Our application can sometimes be rendered within an HTTPS URL.  To
avoid mixed security content warnings in browsers, we were able to
selectively convert our search API calls so they use HTTPS.  However,
the profile image URLs returned by the search API are HTTP URLs, and
changing the protocol to HTTPS doesn't work (it seems like the image
servers don't support HTTPS).  This causes a mixed content warning
when we render those URLs as HTML images.

I would be OK with us having mixed content, but IE8 is particularly
bad at how it confronts users with this condition.  Is there way for
me to create an HTTPS user profile image URL that works?

-- 
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] oAuth Tweet of me api call Could not authenticate

2011-03-22 Thread Abraham Williams
You are making the retweets_of_me request directly with cURL instead of with
TwitterOAuth. You should do something like:

$content = $connection-get('statuses/retweets_of_me');

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 Tue, Mar 22, 2011 at 02:11, deepak deepak.d...@gmail.com wrote:

 Hi,

 we are using the below code to make api call
 The api call to fetch tweet is not working but api call for credential
 is working fine.

 It is showing the below error

 {request:\/1\/statuses\/retweets_of_me.json?,error:Could not
 authenticate you.}


 Please see the below code

 

define('CONSUMER_KEY', $param['CONSUMER_KEY']);
define('CONSUMER_SECRET',$param['CONSUMER_SECRET']);
define('OAUTH_CALLBACK', $param['OAUTH_CALLBACK']);


if(!isset($_SESSION['oauth_token']) ||
 empty($_SESSION['oauth_token'])){
/* Build TwitterOAuth object with client
 credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY,
 CONSUMER_SECRET);

/* Get temporary credentials. */
$request_token =
 $connection-getRequestToken(OAUTH_CALLBACK);

/* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token =
 $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] =
 $request_token['oauth_token_secret'];

/* If last connection failed don't display
 authorization link. */
switch ($connection-http_code) {
  case 200:
/* Build authorize URL and redirect user to
 Twitter. */
$url = $connection-getAuthorizeURL($token);
header('Location: ' . $url);

break;
  default:
/* Show notification if something went
 wrong. */
echo 'Could not connect to Twitter. Refresh
 the page or try again
 later.';
}
}


  
 //
/* Create TwitteroAuth object with app key/secret and token
 key/
 secret from default phase */
$connection = new TwitterOAuth(CONSUMER_KEY,
 CONSUMER_SECRET,
 $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

/* Request access tokens from twitter */
$access_token = $connection-
 getAccessToken($_REQUEST['oauth_verifier']);

/* Save the access tokens. Normally these would be saved in
 a
 database for future use. */
$_SESSION['access_token'] = $access_token;



/* If HTTP response is 200 continue otherwise send to
 connect page
 to retry */
if (200 == $connection-http_code) {

/* The user has been verified and the access tokens
 can be saved
 for future use */
$_SESSION['status'] = 'verified';

/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user
 tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY,
 CONSUMER_SECRET,
 $access_token['oauth_token'], $access_token['oauth_token_secret']);

/* If method is set change API call made. Test is
 called by
 default. */
$content =
 $connection-get('account/verify_credentials');

 $api = 'http://api.twitter.com/1/statuses/
 retweets_of_me.json';

// twitter follower api
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content= curl_exec($ch);
curl_close($ch);
   print_r($content);
session_destroy();

return $content;

} else {

 /* Save HTTP status for error dialog on connnect
 page.*/
if($this-debug){
echo $connection-http_code. ' invalid
 response code. br/';
}
return false;
}

 --
 Twitter developer documentation and resources: http://dev.twitter.com/doc
 API updates via Twitter: 

Re: [twitter-dev] Re: Twiiter Latest 20 Tweets requires authorization

2011-03-22 Thread Abraham Williams
I just posted an answer in the other thread you started:
https://groups.google.com/forum/#!topic/twitter-development-talk/JE_N9nzJI9c

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 Tue, Mar 22, 2011 at 01:47, deepak deepak.d...@gmail.com wrote:

 Hi
 i am using the below code
but it is still showing me error for authentication
but user credential call is working fine.

  define('CONSUMER_KEY', $param['CONSUMER_KEY']);
define('CONSUMER_SECRET',$param['CONSUMER_SECRET']);
define('OAUTH_CALLBACK', $param['OAUTH_CALLBACK']);


if(!isset($_SESSION['oauth_token']) ||
 empty($_SESSION['oauth_token'])){
/* Build TwitterOAuth object with client
 credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY,
 CONSUMER_SECRET);

/* Get temporary credentials. */
$request_token =
 $connection-getRequestToken(OAUTH_CALLBACK);

/* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token =
 $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] =
 $request_token['oauth_token_secret'];

/* If last connection failed don't display
 authorization link. */
switch ($connection-http_code) {
  case 200:
/* Build authorize URL and redirect user to
 Twitter. */
$url = $connection-getAuthorizeURL($token);
header('Location: ' . $url);

break;
  default:
/* Show notification if something went
 wrong. */
echo 'Could not connect to Twitter. Refresh
 the page or try again
 later.';
}
}


  
 //
/* Create TwitteroAuth object with app key/secret and token
 key/
 secret from default phase */
$connection = new TwitterOAuth(CONSUMER_KEY,
 CONSUMER_SECRET,
 $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

/* Request access tokens from twitter */
$access_token = $connection-
 getAccessToken($_REQUEST['oauth_verifier']);

/* Save the access tokens. Normally these would be saved in
 a
 database for future use. */
$_SESSION['access_token'] = $access_token;



/* If HTTP response is 200 continue otherwise send to
 connect page
 to retry */
if (200 == $connection-http_code) {

/* The user has been verified and the access tokens
 can be saved
 for future use */
$_SESSION['status'] = 'verified';

/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user
 tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY,
 CONSUMER_SECRET,
 $access_token['oauth_token'], $access_token['oauth_token_secret']);

/* If method is set change API call made. Test is
 called by
 default. */
$content =
 $connection-get('account/verify_credentials');

// Twitter re tweet api call
   $api = 'http://api.twitter.com/1/statuses/
 retweets_of_me.json';
// request twitter follower api
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content= curl_exec($ch);
curl_close($ch);

 print_r($content);

session_destroy();

return $content;

} else {

 /* Save HTTP status for error dialog on connnect
 page.*/
if($this-debug){
echo $connection-http_code. ' invalid
 response code. br/';
}
return false;
}

 On Mar 22, 1:18 pm, CWorster cwors...@schlimmer.com wrote:
  Here are some OAuth Libraries in PHPhttp://
 dev.twitter.com/pages/oauth_libraries#php
 
  2011/3/22 deepak deepak.d...@gmail.com:
 
   Hi,
 
   We are displaying twitter latest 20 tweets to me on my website.
   but this api call requires authorization and we have not found any
   code for authorization