Permalink
Browse files

adding ability to change HTTP verb for YQL methods

  • Loading branch information...
1 parent f7cf83c commit 91c87e4ade8494eec1f3db8fad8eabe866bac17a @zagraves zagraves committed Jan 29, 2010
Showing with 6 additions and 4 deletions.
  1. +2 −2 lib/Yahoo/YahooOAuthApplication.class.php
  2. +4 −2 lib/Yahoo/YahooYQLQuery.class.php
View
4 lib/Yahoo/YahooOAuthApplication.class.php
@@ -422,7 +422,7 @@ public function getGeoPlaces($location)
return isset($data->query->results) ? $data->query->results : false;
}
- public function yql($query, $parameters = array())
+ public function yql($query, $parameters = array(), $method='GET')
{
if(is_array($query))
{
@@ -432,7 +432,7 @@ public function yql($query, $parameters = array())
$parameters = array_merge(array('q' => $query, 'format' => 'json', 'env' => YahooYQLQuery::DATATABLES_URL), $parameters);
- $oauth_request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, 'GET', YahooYQLQuery::OAUTH_API_URL, $parameters);
+ $oauth_request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, YahooYQLQuery::OAUTH_API_URL, $parameters);
$oauth_request->sign_request($this->signature_method_hmac_sha1, $this->consumer, $this->token);
return json_decode($this->client->access_resource($oauth_request));
View
6 lib/Yahoo/YahooYQLQuery.class.php
@@ -46,9 +46,11 @@ class YahooYQLQuery
const OAUTH_API_URL = 'http://query.yahooapis.com/v1/yql';
const DATATABLES_URL = 'http://datatables.org/alltables.env';
- public function execute($yql, $parameters = array())
+ public function execute($yql, $parameters = array(), $method = YahooCurl::GET)
{
- $http = YahooCurl::fetch(self::PUBLIC_API_URL, array_merge(array('q' => $yql, 'format' => 'json', 'env' => self::DATATABLES_URL), $parameters));
+ $url = self::PUBLIC_API_URL;
+ $parameters = array_merge(array('q' => $yql, 'format' => 'json', 'env' => self::DATATABLES_URL), $parameters);
+ $http = YahooCurl::fetch($url, $parameters, array(), $method);
return ($http) ? json_decode($http['response_body']) : false;
}

0 comments on commit 91c87e4

Please sign in to comment.