/**
  * Contact Twitter for a request token, which will be exchanged for an access token later.
  * @return TwitterOAuthToken Request token
  */
 public static function api_oauth_request_token($consumer_key, $consumer_secret, $oauth_callback = 'oob')
 {
     gltw_log();
     gltw_pr('method params', $consumer_key, $consumer_secret, $oauth_callback);
     $Client = GLTW_API::api_client('oauth');
     gltw_pr($Client);
     $Client->set_oauth($consumer_key, $consumer_secret);
     gltw_pr($Client);
     $params = $Client->oauth_exchange(OAUTH_REQUEST_TOKEN_URL, compact('oauth_callback'));
     gltw_pr($params);
     return new TwitterOAuthToken($params['oauth_token'], $params['oauth_token_secret']);
 }
function gltw_exception_handler($exception)
{
    gltw_pr($exception);
    global $error;
    if (empty($error) || is_null($error)) {
        $error = '';
    }
    $error .= 'Uncaught exception: ' . $exception->getMessage() . '\\n';
}