From 73a73c936251f4f481eba2ca0264b49064797067 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 5 Oct 2010 17:38:03 -0700 Subject: [PATCH] - Update getrequesttoken test script to use 1.0a - Some cleanup --- tests/oauth/getrequesttoken.php | 39 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/oauth/getrequesttoken.php b/tests/oauth/getrequesttoken.php index fc6f03379c..11ec126b79 100755 --- a/tests/oauth/getrequesttoken.php +++ b/tests/oauth/getrequesttoken.php @@ -2,7 +2,7 @@ sign_request($hmac_method, $test_consumer, NULL); - $r = httpRequest($req_req->to_url()); + $req = OAuthRequest::from_consumer_and_token( + $testConsumer, + null, + "GET", + $requestTokenUrl, + $params + ); + $req->sign_request($hmac_method, $testConsumer, NULL); + $r = httpRequest($req->to_url()); } catch (Exception $e) { // oh noez print $e->getMessage(); - var_dump($req_req); + var_dump($req); exit(1); } $body = $r->getBody(); -$token_stuff = array(); -parse_str($body, $token_stuff); +$tokenStuff = array(); +parse_str($body, $tokenStuff); -if (empty($token_stuff['oauth_token'])) { +if (empty($tokenStuff['oauth_token'])) { print "Error: $body\n"; exit(1); } -$authurl = $ini['apiroot'] . $ini['authorize_url'] . '?oauth_token=' . $token_stuff['oauth_token']; +$authurl = $ini['apiroot'] . $ini['authorize_url'] . '?oauth_token=' . $tokenStuff['oauth_token']; print "\nSuccess!\n\n"; -print 'Request token : ' . $token_stuff['oauth_token'] . "\n"; -print 'Request token secret : ' . $token_stuff['oauth_token_secret'] . "\n"; +print 'Request token : ' . $tokenStuff['oauth_token'] . "\n"; +print 'Request token secret : ' . $tokenStuff['oauth_token_secret'] . "\n"; print "Authorize URL : $authurl\n"; print "\nNow paste the Authorize URL into your browser and authorize the request token.\n"; @@ -72,7 +79,7 @@ print "\nNow paste the Authorize URL into your browser and authorize the request function httpRequest($url) { $request = HTTPClient::start(); - + $request->setConfig( array( 'follow_redirects' => true, @@ -82,7 +89,7 @@ function httpRequest($url) 'ssl_verify_host' => false ) ); - + return $request->get($url); }