TijsVerkoyen\Twitter\Twitter::oAuthRequestToken PHP Метод

oAuthRequestToken() публичный Метод

This method fulfills Secion 6.1 of the OAuth 1.0 authentication flow.
public oAuthRequestToken ( string[optional] $callbackURL = null ) : array
$callbackURL string[optional]
Результат array An array containg the token and the secret
    public function oAuthRequestToken($callbackURL = null)
    {
        // init var
        $parameters = null;
        // set callback
        if ($callbackURL != null) {
            $parameters['oauth_callback'] = (string) $callbackURL;
        }
        // make the call
        $response = $this->doOAuthCall('request_token', $parameters);
        // validate
        if (!isset($response['oauth_token'], $response['oauth_token_secret'])) {
            throw new Exception(implode(', ', array_keys($response)));
        }
        // set some properties
        if (isset($response['oauth_token'])) {
            $this->setOAuthToken($response['oauth_token']);
        }
        if (isset($response['oauth_token_secret'])) {
            $this->setOAuthTokenSecret($response['oauth_token_secret']);
        }
        // return
        return $response;
    }
Twitter