diff options
author | Evan Prodromou <evan@status.net> | 2010-09-05 01:49:49 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-09-07 04:00:59 -0400 |
commit | 28fecf70b998943606a556d7a98a0406dba67893 (patch) | |
tree | 813605e66371e0c1445f558259de12bede4d7937 /plugins/TwitterBridge | |
parent | a844aaaea6e9ec603bd4a070cfa62ae610993e58 (diff) |
better handling of params in oauthget
Diffstat (limited to 'plugins/TwitterBridge')
-rw-r--r-- | plugins/TwitterBridge/twitteroauthclient.php | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/plugins/TwitterBridge/twitteroauthclient.php b/plugins/TwitterBridge/twitteroauthclient.php index 5d10d8f71..876e30425 100644 --- a/plugins/TwitterBridge/twitteroauthclient.php +++ b/plugins/TwitterBridge/twitteroauthclient.php @@ -218,13 +218,7 @@ class TwitterOAuthClient extends OAuthClient $params['page'] = $page; } - $qry = http_build_query($params); - - if (!empty($qry)) { - $url .= "?$qry"; - } - - $response = $this->oAuthGet($url); + $response = $this->oAuthGet($url, $params); $statuses = json_decode($response); return $statuses; } @@ -244,17 +238,25 @@ class TwitterOAuthClient extends OAuthClient { $url = "https://twitter.com/statuses/friends.json"; - $params = array('id' => $id, - 'user_id' => $user_id, - 'screen_name' => $screen_name, - 'page' => $page); - $qry = http_build_query($params); + $params = array(); + + if (!empty($id)) { + $params['id'] = $id; + } + + if (!empty($user_id)) { + $params['user_id'] = $user_id; + } - if (!empty($qry)) { - $url .= "?$qry"; + if (!empty($screen_name)) { + $params['screen_name'] = $screen_name; } - $response = $this->oAuthGet($url); + if (!empty($page)) { + $params['page'] = $page; + } + + $response = $this->oAuthGet($url, $params); $friends = json_decode($response); return $friends; } @@ -274,17 +276,25 @@ class TwitterOAuthClient extends OAuthClient { $url = "https://twitter.com/friends/ids.json"; - $params = array('id' => $id, - 'user_id' => $user_id, - 'screen_name' => $screen_name, - 'page' => $page); - $qry = http_build_query($params); + $params = array(); + + if (!empty($id)) { + $params['id'] = $id; + } + + if (!empty($user_id)) { + $params['user_id'] = $user_id; + } - if (!empty($qry)) { - $url .= "?$qry"; + if (!empty($screen_name)) { + $params['screen_name'] = $screen_name; + } + + if (!empty($page)) { + $params['page'] = $page; } - $response = $this->oAuthGet($url); + $response = $this->oAuthGet($url, $params); $ids = json_decode($response); return $ids; } |