/** * Send a POST request to the specified URL with the specified payload. * @param string $url * @param string $data * @return string Remote data **/ public function sendPOST($url, $data = array()) { $data['_fake_status'] = '200'; // Send the actual request. $this->instance->setHeader('User-Agent', sprintf(Imgur::$user_agent, Imgur::$key)); $this->instance->setMethod('POST'); $this->instance->setUrl($url); foreach ($data as $k => $v) { $this->instance->addPostParameter($k, $v); } try { /** @var HTTP_Request2_Response */ $response = $this->instance->send(); return $response->getBody(); } catch (HTTP_Request2_Exception $e) { throw new Imgur_Exception("HTTP Request Failure", null, $e); } catch (Exception $e) { throw new Imgur_Exception("Unknown Failure during HTTP Request", null, $e); } }