[twitter-dev] Users/Lookup
Hi, I have read all the users/lookup related posts and also scoured the internet looking for an appropriate example.I posted a question as a reply on one but don't see it so I am hoping someone can help a twitter api newbie. I just want to get results from users/lookup. I am using Abraham's Oauth library, which I have been able to get to work in other instances with no problems. I'm hoping it's my lack of understanding of how the syntax should be. Here is the code: // all values populated correctly $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $OAuthKey, $OAuthSecret); // saw this example as correction of the following line; neither seems to work $userDeets = $connection-get('/users/lookup.json', array('screen_name' = 'biz,twitterapi')); // $userDeets = $connection-get('/users/lookup.json? screen_name=biz,twitterapi'); foreach ($userDeets as $item) { echo $item-followers_count; echo br; } Thanks in advance for any insight. -Gabe -- 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: users/lookup.json
If anyone can help me I would SO appreciate. I have successfully used Abraham's Twitter Oauth in the past, yet I am relatively new to Twitter API programming. I am trying to use users/lookup and understand that it has to be authenticated. I am not getting results and I have searched for clear examples but haven't found any, I think it is partly because I don't understand how to use the syntax. (That's why I like examples.) Anyway the code is here: $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $OAuthKey, $OAuthSecret); // saw this example somewhere $userDeets = $connection-get('/users/lookup.json', array('screen_name' = 'biz,twitterapi')); // neither method seems to work. Advice on which one to use would also be nice. // $userDeets = $connection-get('/users/lookup.json? screen_name=biz,twitterapi'); foreach ($userDeets as $item) { echo $item-followers_count; echo br; } Again I'm hoping it's just something stupid syntactically that I'm doing. -Gabe On Mar 6, 1:13 pm, Randolph Estebat raeste...@gmail.com wrote: Naresh -- users/lookup requires authentication. You would need to OAuth with Twitter for you to get this API working. On Sat, Mar 5, 2011 at 11:04 AM, Naresh naresh.jonn...@gmail.com wrote: hi! i am very new to twitter API. my question is: http://api.twitter.com/1/users/lookup.json?user_id=1401881,1401882 this is example url of twitter, it never works. and it returns { * request: /1/users/lookup.json?user_id=1401881,1401882 * error: Could not authenticate you. } could you tell me, how to get friends info, like name, thum,...etc thanx - naresh jonnala. -- 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 -- Randolph Estebat -- 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: Users/Lookup
Neither works. Am I processing the results correctly? On Apr 12, 3:25 pm, Abraham Williams 4bra...@gmail.com wrote: Try: $userDeets = $connection-get('users/lookup' array('screen_name' = 'biz,twitterapi')); That should work. 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, Apr 12, 2011 at 12:15, Gabe oneill.g...@gmail.com wrote: Hi, I have read all the users/lookup related posts and also scoured the internet looking for an appropriate example.I posted a question as a reply on one but don't see it so I am hoping someone can help a twitter api newbie. I just want to get results from users/lookup. I am using Abraham's Oauth library, which I have been able to get to work in other instances with no problems. I'm hoping it's my lack of understanding of how the syntax should be. Here is the code: // all values populated correctly $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $OAuthKey, $OAuthSecret); // saw this example as correction of the following line; neither seems to work $userDeets = $connection-get('/users/lookup.json', array('screen_name' = 'biz,twitterapi')); // $userDeets = $connection-get('/users/lookup.json? screen_name=biz,twitterapi'); foreach ($userDeets as $item) { echo $item-followers_count; echo br; } Thanks in advance for any insight. -Gabe -- 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: Users/Lookup
Thanks to Abraham for reminding me about var_dump which showed the results as NULL. At risk of outing myself as stupid I will do so anyway in case there might be someone out there who has also been searching for how to do this, from start to finish. This code works. The stupid part was not putting the entire URL in the get statement. I was errantly going by a different example. Assuming you are familiar with Abraham's Oauth library, $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $OAuthKey, $OAuthSecret); $userDeets = $connection-get('http://api.twitter.com/1/users/ lookup.json', array('screen_name' = 'biz, twitterapi')); //var_dump($userDeets); foreach ($userDeets as $item) { echo $item-screen_name . : ; echo $item-followers_count; echo br; } On Apr 12, 3:31 pm, Gabe oneill.g...@gmail.com wrote: Neither works. Am I processing the results correctly? On Apr 12, 3:25 pm, Abraham Williams 4bra...@gmail.com wrote: Try: $userDeets = $connection-get('users/lookup' array('screen_name' = 'biz,twitterapi')); That should work. 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, Apr 12, 2011 at 12:15, Gabe oneill.g...@gmail.com wrote: Hi, I have read all the users/lookup related posts and also scoured the internet looking for an appropriate example.I posted a question as a reply on one but don't see it so I am hoping someone can help a twitter api newbie. I just want to get results from users/lookup. I am using Abraham's Oauth library, which I have been able to get to work in other instances with no problems. I'm hoping it's my lack of understanding of how the syntax should be. Here is the code: // all values populated correctly $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $OAuthKey, $OAuthSecret); // saw this example as correction of the following line; neither seems to work $userDeets = $connection-get('/users/lookup.json', array('screen_name' = 'biz,twitterapi')); // $userDeets = $connection-get('/users/lookup.json? screen_name=biz,twitterapi'); foreach ($userDeets as $item) { echo $item-followers_count; echo br; } Thanks in advance for any insight. -Gabe -- 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: Using OAuth Echo
Is there any reference implementation of OAuth Echo from a Delegator perspective? I just cannot get this working no matter what. -- 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] Using OAuth Echo
I'm attempting to build an image service of sorts and am trying to implement OAuth Echo to authorize users and get the username of the person posting the picture. Anyway, I seem to be having trouble and I think I may be doing something wrong. I keep getting the error Could not authenticate with OAuth. What I am doing is: - Taking the value passed in the header for X-Verify-Credentials- Authorization - URL encode the value - Use it for my Authorization header in my request to https://api.twitter.com/1/account/verify_credentials.json I am attempting to do this using Twitter4J and the following code illustrates what I'm doing: TwitterFactory factory = new TwitterFactory(); Twitter twitter = factory.getInstance(new EchoAuthorization(request.getHeader(X-Verify-Credentials- Authorization))); try { System.out.println(twitter.verifyCredentials()); } catch(Exception ex) { ex.printStackTrace(); } - public class EchoAuthorization implements Authorization { private String authHeader; public String getAuthHeader() { return authHeader; } public void setAuthHeader(String authHeader) { this.authHeader = authHeader; } public EchoAuthorization (String authHeader) { setAuthHeader(new URLEncoder().encode(authHeader)); System.out.println(getAuthHeader()); } public boolean isEnabled() { return true; } public String getAuthorizationHeader(HttpRequest arg0) { System.out.println(auth header:+getAuthHeader()); return getAuthHeader(); } } Any help would be greatly appreciated! I've been stuck on this for a while... -- 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] Twitter OAuth Problem
Hi, I have been using Abraham's OAuth library and I *almost* have it working. I'm a longtime C++ developer but new to Twitter API. Anyway, it took me a while to use the callback.php file as the actual call back. That (I thought) was the missing element, I was under the impression that the test.php file in his library could be substituted for the callback. Anyway when I realized the mistake I was happy to implement the new code. The new callback is being called but I am consistently getting HTTP Error Code 401 (unauthorized) when it is being used, and I am using it basically as is. Any insight would be appreciated. Note - I did regenerate my application registration recently - how long does it take for those credentials to be usable? Thanks much. -Gabe
[twitter-dev] Re: Twitter OAuth Problem
I think I might have answered my own question. It seems when I created the new app registration I forgot to check the box at the bottom which says to use Twitter for login. Now Twitter won't let me change it. I expect that will fix it. On Jul 20, 2:02 pm, Gabe oneill.g...@gmail.com wrote: Hi, I have been using Abraham's OAuth library and I *almost* have it working. I'm a longtime C++ developer but new to Twitter API. Anyway, it took me a while to use the callback.php file as the actual call back. That (I thought) was the missing element, I was under the impression that the test.php file in his library could be substituted for the callback. Anyway when I realized the mistake I was happy to implement the new code. The new callback is being called but I am consistently getting HTTP Error Code 401 (unauthorized) when it is being used, and I am using it basically as is. Any insight would be appreciated. Note - I did regenerate my application registration recently - how long does it take for those credentials to be usable? Thanks much. -Gabe
[twitter-dev] Re: Twitter OAuth Problem
I did notice something odd about that. My app page on Twitter says the opposite tho - to remove the api.. I will try your suggestion and thanks!! On Jul 20, 2:57 pm, Elmseeker elmsee...@gmail.com wrote: in twitteroauth.php you will find 4 lines function accessTokenURL() { return 'https://api.twitter.com/oauth/ access_token'; } function authenticateURL() { return 'https://twitter.com/oauth/ authenticate'; } function authorizeURL() { return 'https://twitter.com/oauth/ authorize'; } function requestTokenURL() { return 'https://api.twitter.com/oauth/ request_token'; } the 2 in the middle need to be changed to: function authenticateURL() { return 'https://api.twitter.com/oauth/ authenticate'; } function authorizeURL() { return 'https://api.twitter.com/oauth/ authorize'; } hope this helps. On Jul 20, 11:02 am, Gabe oneill.g...@gmail.com wrote: Hi, I have been using Abraham's OAuth library and I *almost* have it working. I'm a longtime C++ developer but new to Twitter API. Anyway, it took me a while to use the callback.php file as the actual call back. That (I thought) was the missing element, I was under the impression that the test.php file in his library could be substituted for the callback. Anyway when I realized the mistake I was happy to implement the new code. The new callback is being called but I am consistently getting HTTP Error Code 401 (unauthorized) when it is being used, and I am using it basically as is. Any insight would be appreciated. Note - I did regenerate my application registration recently - how long does it take for those credentials to be usable? Thanks much. -Gabe
[twitter-dev] Re: Twitter OAuth Problem
Actually I was able to turn the switch on and also make these changes. Neither fixed the problem. Still getting the 401 error. I know OAuth has been down today but it is working at least for now. On Jul 20, 2:57 pm, Elmseeker elmsee...@gmail.com wrote: in twitteroauth.php you will find 4 lines function accessTokenURL() { return 'https://api.twitter.com/oauth/ access_token'; } function authenticateURL() { return 'https://twitter.com/oauth/ authenticate'; } function authorizeURL() { return 'https://twitter.com/oauth/ authorize'; } function requestTokenURL() { return 'https://api.twitter.com/oauth/ request_token'; } the 2 in the middle need to be changed to: function authenticateURL() { return 'https://api.twitter.com/oauth/ authenticate'; } function authorizeURL() { return 'https://api.twitter.com/oauth/ authorize'; } hope this helps. On Jul 20, 11:02 am, Gabe oneill.g...@gmail.com wrote: Hi, I have been using Abraham's OAuth library and I *almost* have it working. I'm a longtime C++ developer but new to Twitter API. Anyway, it took me a while to use the callback.php file as the actual call back. That (I thought) was the missing element, I was under the impression that the test.php file in his library could be substituted for the callback. Anyway when I realized the mistake I was happy to implement the new code. The new callback is being called but I am consistently getting HTTP Error Code 401 (unauthorized) when it is being used, and I am using it basically as is. Any insight would be appreciated. Note - I did regenerate my application registration recently - how long does it take for those credentials to be usable? Thanks much. -Gabe