From 30fcadaa51dd77c5f7fd74091c0070a484c5a43f Mon Sep 17 00:00:00 2001 From: Miles O'Keefe Date: Wed, 15 May 2013 21:41:09 -0600 Subject: [PATCH] Update README.md Updated the profile image section to work with Twitter API v1.1 as the previous code now returns an error. --- README.md | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 287b7a8..07d2c63 100644 --- a/README.md +++ b/README.md @@ -246,28 +246,19 @@ How Do I…? …access a user’s profile image? ------------------------------- -The Twitter API usually contains data in either JSON or XML. However, the -templated method ```users/profile_image/:screen_name``` uses a HTTP 302 redirect -to send you to the requested image file URL. +First retrieve the user object using -Codebird intercepts this HTTP redirect and extracts the profile image URL instead. -Thus, the following API call: +```$reply = $cb->users_show("screen_name=$username");``` -```php -$reply = $cb->users_profileImage_SCREEN_NAME('screen_name=mynetx&size=mini'); -``` -returns an object with the following contents: -``` -stdClass Object -( - [profile_image_url_https] => https://si0.twimg.com/profile_images/1417135246/Blue_Purple.96_mini.png - [httpstatus] => 302 -) -``` +with ```$username``` being the username of the account you wish to retrieve the profile image from. + +Then get the value from the index ```profile_image_url``` or ```profile_image_url_https``` of the user object previously retrieved. + + +For example: -You can find out how to build the Codebird method name, in the section -‘Mapping API methods to Codebird function calls.’ +```$reply['profile_image_url']``` will then return the profile image url without https. …get user ID, screen name and more details about the current user? ------------------------------------------------------------------