diff options
author | purplecode <niespammnie@gmail.com> | 2013-12-08 11:35:06 +0100 |
---|---|---|
committer | purplecode <niespammnie@gmail.com> | 2013-12-08 11:35:06 +0100 |
commit | 8778a35b419bbaeea44d21ad40beb175d474f766 (patch) | |
tree | ed4ad5a5ef896a52cfcae35eefd5f7a01dbe10fa /src/PCurl.php | |
parent | 446368cbabb930e386c583a65eeee859912992fc (diff) | |
download | php.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.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);
|