Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
Array/stdObject support added
Browse files Browse the repository at this point in the history
Sometimes it is very handy to receive a response as array. In these
cases use last parameter of the methods.
  • Loading branch information
MunGell committed Jan 20, 2012
1 parent 67b0a5a commit 76aef1b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions twitteroauth/twitteroauth.php
Expand Up @@ -142,32 +142,32 @@ function getXAuthToken($username, $password) {
/**
* GET wrapper for oAuthRequest.
*/
function get($url, $parameters = array()) {
function get($url, $parameters = array(), $output_type = 0) {
$response = $this->oAuthRequest($url, 'GET', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
return json_decode($response, $output_type);
}
return $response;
}

/**
* POST wrapper for oAuthRequest.
*/
function post($url, $parameters = array()) {
function post($url, $parameters = array(), $output_type = 0) {
$response = $this->oAuthRequest($url, 'POST', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
return json_decode($response, $output_type);
}
return $response;
}

/**
* DELETE wrapper for oAuthReqeust.
*/
function delete($url, $parameters = array()) {
function delete($url, $parameters = array(), $output_type = 0) {
$response = $this->oAuthRequest($url, 'DELETE', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
return json_decode($response, $output_type);
}
return $response;
}
Expand Down

0 comments on commit 76aef1b

Please sign in to comment.