summaryrefslogtreecommitdiffstats
path: root/src/PCurl.php
diff options
context:
space:
mode:
authorpurplecode <niespammnie@gmail.com>2013-12-08 11:35:06 +0100
committerpurplecode <niespammnie@gmail.com>2013-12-08 11:35:06 +0100
commit8778a35b419bbaeea44d21ad40beb175d474f766 (patch)
treeed4ad5a5ef896a52cfcae35eefd5f7a01dbe10fa /src/PCurl.php
parent446368cbabb930e386c583a65eeee859912992fc (diff)
downloadphp.curl-8778a35b419bbaeea44d21ad40beb175d474f766.zip
php.curl-8778a35b419bbaeea44d21ad40beb175d474f766.tar.gz
php.curl-8778a35b419bbaeea44d21ad40beb175d474f766.tar.bz2
delete support
Diffstat (limited to 'src/PCurl.php')
-rw-r--r--src/PCurl.php13
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);