protected function request($method, $path, $getParameters = [], $postParameters = [], $files = []) { $request = new ResourceRequest($method, $this->getApiUrl($path, $getParameters), $this->config->getAppID(), $this->config->getAppSecret(), $this->config->getAccessTokenKey(), $this->config->getAccessTokenSecret(), SignatureMethods::SIGNATURE_HMAC_SHA1); foreach ($postParameters as $key => $value) { $request->setPostParameter($key, $value); } foreach ($files as $name => $file) { $request->addFile($name, $file); } $transporter = $this->getTransporter($request); $transporter->send(); $this->response = $transporter->getResponse(); $this->responseData = json_decode($this->response->getBody()); }
/** * @param $method * @param $url * @param array $postParameter * @return \Protocol\HTTP\Response */ public function requestResource($method, $url, $postParameter = []) { $request = new ResourceRequest($method, $url, $this->consumerKey, $this->consumerSecret, $this->accessTokenKey, $this->accessTokenSecret, $this->signatureMethod); foreach ($postParameter as $key => $value) { $request->setPostParameter($key, $value); } $transporter = $this->getTransporter($request); $transporter->send(); return $transporter->getResponse(); }