J7mbo / twitter-api-php

The simplest PHP Wrapper for Twitter API v1.1 calls
MIT License
1.82k stars 802 forks source link

profile_image_url_https #211

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi ! I'm testing your APi for twitter. But, I don't know how I can get the 'profile_image_url_https'. My code : ` $postfields = array( 'profile_image_url_https' => $twitter['userID'] );

    require_once('../../externe/api/TwitterAPIExchange.php');
    $settings = array(
        'oauth_access_token' => '',
        'oauth_access_token_secret' => '',
        'consumer_key' => "",
        'consumer_secret' => ""
    );

    $url = 'https://api.twitter.com/1.1/blocks/create.json';
    $requestMethod = 'POST';

    $twitter_requete = new TwitterAPIExchange($settings);
    $twitter_resultat =  $twitter_requete->buildOauth($url, $requestMethod)
        ->setPostfields($postfields)
        ->performRequest();`

But i have an error 50 : {"errors":[{"code":50,"message":"User not found."}]}

Is it the best way to get the user image profile ? In fact, I don't know what i must put in the postfields var ? For example to get image profile or banner.

Thanks !

ghost commented 7 years ago

Okay... My new code....

` require_once('../../externe/api/TwitterAPIExchange.php'); $settings = array( 'oauth_access_token' => '', 'oauth_access_token_secret' => '', 'consumer_key' => "", 'consumer_secret' => "" );

    $url = 'https://api.twitter.com/1.1/users/show.json';
    $getfield = '?screen_name=rwanitolp';
    $requestMethod = 'GET';

    $twitter = new TwitterAPIExchange($settings);
    $twitter_resultat= $twitter->setGetfield($getfield)
        ->buildOauth($url, $requestMethod)
        ->performRequest();`

But, I dont have my profile_image_url_https or profile_image_url, In url I have : "urls":[]. However, I have a user image profile in my account... An idea ?