diff --git a/tests/oauth/verifycreds.php b/tests/oauth/verifycreds.php index 873bdb8bdd..7eea6e7e74 100755 --- a/tests/oauth/verifycreds.php +++ b/tests/oauth/verifycreds.php @@ -22,15 +22,15 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..')); require_once INSTALLDIR . '/extlib/OAuth.php'; -$shortoptions = 'o:s:'; -$longoptions = array('oauth_token=', 'token_secret='); +$shortoptions = 't:s:'; +$longoptions = array('oauth_token=', 'oauth_token_secret='); $helptext = <<sign_request($hmac_method, $test_consumer, $at); + $hmac_method = new OAuthSignatureMethod_HMAC_SHA1(); -$r = httpRequest($req_req->to_url()); + $oauthReq = OAuthRequest::from_consumer_and_token( + $consumer, + $atok, + "GET", + $endpoint, + $params + ); -$body = $r->getBody(); + $oauthReq->sign_request($hmac_method, $consumer, $atok); -print "$body\n"; + $httpReq = httpRequest($oauthReq->to_url()); -//print $req_req->to_url() . "\n\n"; +} catch (Exception $e) { + print "Error! HTTP response body: " . $httpReq->getBody(); + exit(1); +} + +print $httpReq->getBody(); function httpRequest($url) { $request = HTTPClient::start(); - $request->setConfig(array( - 'follow_redirects' => true, - 'connect_timeout' => 120, - 'timeout' => 120, - 'ssl_verify_peer' => false, - 'ssl_verify_host' => false - )); + $request->setConfig( + array( + 'follow_redirects' => true, + 'connect_timeout' => 120, + 'timeout' => 120, + 'ssl_verify_peer' => false, + 'ssl_verify_host' => false + ) + ); return $request->get($url); } -