public static function request($data, $applicationSecret) { $data['sig'] = self::getSignature($data, $applicationSecret); $response = HttpClient::exec('GET', self::API_URL, $data); $data = json_decode($response, true); if (isset($data['error'])) { throw new \RuntimeException($data['error']); } return $data; }
public function exec($method, $url, array $parameters = array()) { $method = strtoupper($method); $defaults = array('oauth_version' => '1.0', 'oauth_nonce' => md5(microtime() . mt_rand()), 'oauth_timestamp' => time(), 'oauth_consumer_key' => $this->consumerKey, 'oauth_signature_method' => 'HMAC-SHA1'); if ($this->oauthToken != null) { $defaults['oauth_token'] = $this->oauthToken; } $parameters = array_merge($defaults, $parameters); $parameters['oauth_signature'] = $this->buildOAuthSignature($method, $url, $parameters); $parametersStr = OAuth1Client::buildHttpQuery($parameters); return HttpClient::exec($method, $url, $parametersStr); }
protected function execGet($url, array $data = array()) { return HttpClient::exec('GET', $url, $data); }
protected function execPost($url, array $data = array()) { return HttpClient::exec('POST', $url, $data); }
protected function execPost($url, $data = array()) { return \Social\Util\HttpClient::exec('POST', $url, http_build_query($data, null, '&')); }