Boom
Boom

Reputation: 41

API Twitter 1.1 account/update_profile_image

I do not know at all how to get the avatar of the profile of a twitter account: / Even looking at the DOC here: https://dev.twitter.com/rest/reference/post/account/update_profile_image If a kind person could help me. Here is my code without the class

if(isset($_GET['name']))
{
$name= htmlentities($_GET['name']);
} 

$cache = 'cache/tweets.tmp';
      if(time() - filemtime($cache) > 60){
        require 'class/twitteroauth.php';
        $connection = new TwitterOAuth('***','****', '**-**', '****');
        $pics = $connection->post('account/update_profile_image','//screen_name => HERE...$name....');
        //var_dump($pics);
        file_put_contents($cache, serialize($pics));
      }else{
        echo 'Cache utilisé';
        $pics = unserialize(file_get_contents($cache));
      }

Upvotes: 0

Views: 347

Answers (1)

Darshan Rai
Darshan Rai

Reputation: 130

You're looking at the documentation for updating a Twitter user's profile image. From your question, I take it that you simply want to get this image. Remember a POST request is meant for creating new content, not simply GETting it.

Have a look at this:
https://dev.twitter.com/rest/reference/get/users/show

The users/show method provides various information about the user, including a link to the image with the key profile_image_url.

This answer should provide more detail to help you figure it out.

Upvotes: 1

Related Questions