public static function GetRequestToken(OAuthConsumer $consumer, $scope,
      $endpoint, $applicationName, $callbackUrl) {
    $signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();

    // Set parameters.
    $params = array();
    $params['scope'] = $scope;
    if (isset($applicationName)) {
      $params['xoauth_displayname'] = $applicationName;
    }
    if (isset($callbackUrl)) {
      $params['oauth_callback'] = $callbackUrl;
    }

    // Create and sign request.
    $request = OAuthRequest::from_consumer_and_token($consumer, NULL, 'GET',
        $endpoint, $params);
    $request->sign_request($signatureMethod, $consumer, NULL);

    // Get token.
    return self::GetTokenFromUrl($request->to_url());
  }