File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -246,28 +246,19 @@ How Do I…?
246
246
…access a user’s profile image?
247
247
-------------------------------
248
248
249
- The Twitter API usually contains data in either JSON or XML. However, the
250
- templated method ``` users/profile_image/:screen_name ``` uses a HTTP 302 redirect
251
- to send you to the requested image file URL.
249
+ First retrieve the user object using
252
250
253
- Codebird intercepts this HTTP redirect and extracts the profile image URL instead.
254
- Thus, the following API call:
251
+ ``` $reply = $cb->users_show("screen_name=$username"); ```
255
252
256
- ``` php
257
- $reply = $cb->users_profileImage_SCREEN_NAME('screen_name=mynetx&size=mini');
258
- ```
259
253
260
- returns an object with the following contents:
261
- ```
262
- stdClass Object
263
- (
264
- [profile_image_url_https] => https://si0.twimg.com/profile_images/1417135246/Blue_Purple.96_mini.png
265
- [httpstatus] => 302
266
- )
267
- ```
254
+ with ``` $username ``` being the username of the account you wish to retrieve the profile image from.
255
+
256
+ Then get the value from the index ``` profile_image_url ``` or ``` profile_image_url_https ``` of the user object previously retrieved.
257
+
258
+
259
+ For example:
268
260
269
- You can find out how to build the Codebird method name, in the section
270
- ‘Mapping API methods to Codebird function calls.’
261
+ ``` $reply['profile_image_url'] ``` will then return the profile image url without https.
271
262
272
263
…get user ID, screen name and more details about the current user?
273
264
------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments