diff options
-rw-r--r-- | src/PCurl.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/PCurl.php b/src/PCurl.php index 301da54..dd70863 100644 --- a/src/PCurl.php +++ b/src/PCurl.php @@ -13,6 +13,11 @@ class PCurl { private $headers;
public function __construct($host) {
+
+ if (!function_exists('curl_init')) {
+ throw new PCurlException('CURL module not available! See http://php.net/manual/en/book.curl.php');
+ }
+
$this->host = $host;
$this->headers = array();
$this->options = array();
@@ -68,6 +73,14 @@ class PCurl { /**
* @return string
*/
+ public function delete($url) {
+ $this->setOption(CURLOPT_CUSTOMREQUEST, 'DELETE');
+ return $this->exec($url);
+ }
+
+ /**
+ * @return string
+ */
private function exec($url) {
$this->setOption(CURLOPT_URL, $this->host . $url);
$this->setOption(CURLOPT_HTTPHEADER, $this->headers);
|