Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Changing return value of getFullResponse()
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Aug 24, 2011
1 parent f8b7c83 commit 7a84911
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions vendors/OAuth/oauth_consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct($consumerKey, $consumerSecret = '') {
}

/**
* Call API with a GET request
* Call API with a GET request. Returns either false on failure or the response body.
*/
public function get($accessTokenKey, $accessTokenSecret, $url, $getData = array()) {
$accessToken = new OAuthToken($accessTokenKey, $accessTokenSecret);
Expand All @@ -46,18 +46,18 @@ public function getAccessToken($accessTokenURL, $requestToken, $httpMethod = 'PO
}

/**
* Useful for debugging purposes to see what is returned when requesting a request/access token.
* Returns an array with the complete response of the previous request, or null, if there was no request.
*/
public function getFullResponse() {
return $this->fullResponse;
}

/**
* @param $requestTokenURL
* @param $callback An absolute URL to which the Service Provider will redirect the User back when the Obtaining User
* Authorization step is completed. If the Consumer is unable to receive callbacks or a callback URL
* @param $callback An absolute URL to which the server will redirect the resource owner back when the Resource Owner
* Authorization step is completed. If the client is unable to receive callbacks or a callback URL
* has been established via other means, the parameter value MUST be set to oob (case sensitive), to
* indicate an out-of-band configuration. Section 6.1.1 from http://oauth.net/core/1.0a
* indicate an out-of-band configuration. Section 2.1 from http://tools.ietf.org/html/rfc5849
* @param $httpMethod 'POST' or 'GET'
* @param $parameters
*/
Expand All @@ -70,7 +70,7 @@ public function getRequestToken($requestTokenURL, $callback = 'oob', $httpMethod
}

/**
* Call API with a POST request
* Call API with a POST request. Returns either false on failure or the response body.
*/
public function post($accessTokenKey, $accessTokenSecret, $url, $postData = array()) {
$accessToken = new OAuthToken($accessTokenKey, $accessTokenSecret);
Expand Down Expand Up @@ -101,12 +101,18 @@ private function createRequest($httpMethod, $url, $token, array $parameters) {

private function doGet($url) {
$socket = new HttpSocket();
return $socket->get($url);
$result = $socket->get($url);
$this->fullResponse = $socket->response;

return $result;
}

private function doPost($url, $data) {
$socket = new HttpSocket();
return $socket->post($url, $data);
$result = $socket->post($url, $data);
$this->fullResponse = $socket->response;

return $result;
}

private function doRequest($request) {
Expand All @@ -116,7 +122,6 @@ private function doRequest($request) {
$data = $this->doGet($request->to_url());
}

$this->fullResponse = $data;
$response = array();
parse_str($data, $response);

Expand Down

0 comments on commit 7a84911

Please sign in to comment.