Skip to content

Commit

Permalink
added empty documentation file and decode json returns.
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham committed Dec 1, 2009
1 parent 9384fd7 commit 41c11d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions DOCUMENTATION
@@ -0,0 +1 @@
Coming soon...
4 changes: 3 additions & 1 deletion html.inc
Expand Up @@ -30,7 +30,9 @@
<?php echo '<h3>'.$status_text.'</h3>'; ?>
<?php } ?>
<p>
<?php echo $content; ?>
<pre>
<?php print_r($content); ?>
</pre>
</p>

</body>
Expand Down
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -20,7 +20,7 @@
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);

/* If method is set change API call made. Test is called by default. */
$content = '<pre>'.$connection->get('account/verify_credentials').'</pre>';
$content = $connection->get('account/verify_credentials');

/* Some example calls */
//$connection->get('users/show', array('screen_name' => 'abraham')));
Expand Down
21 changes: 15 additions & 6 deletions twitteroauth/twitteroauth.php
Expand Up @@ -119,21 +119,33 @@ function getAccessToken($oauth_verifier = FALSE) {
* GET wrappwer for oAuthRequest.
*/
function get($url, $parameters = NULL) {
return $this->oAuthRequest($url, 'GET', $parameters);
$response = $this->oAuthRequest($url, 'GET', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response);
}
return $response;
}

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

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

/**
Expand Down Expand Up @@ -185,9 +197,6 @@ function http($url, $method, $postfields = NULL) {
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->last_api_call = $url;
curl_close ($ci);
//if ($this->format === 'json' && $this->decode_json) {
// return json_decode($response);
//}
return $response;
}
}

0 comments on commit 41c11d1

Please sign in to comment.