Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added deleteDoc method to Couchbase_CouchDB

  • Loading branch information...
commit 5823f73c3ac0618f86752252520787cc6ce894c7 1 parent 0fb27a2
@ezarko authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 Couchbase/CouchDB.php
View
14 Couchbase/CouchDB.php
@@ -52,6 +52,18 @@ function deleteDb($name)
}
/**
+ * Delete a document.
+ *
+ * @param string $doc JSON representation of a document.
+ * @return string JSON success or error message.
+ */
+ function deleteDoc($doc)
+ {
+ $doc = json_decode($doc);
+ return $this->send("DELETE", $this->server->path . "/" . $doc->_id . "?rev=" . $doc->_rev);
+ }
+
+ /**
* Save a document.
*
* @param string $doc JSON representation of a document.
@@ -193,7 +205,7 @@ function send($method, $url, $post_data = NULL, $content_type = "application/jso
$response .= fgets($s);
}
- list($this->headers, $this->body) = explode("\r\n\r\n", $response);
+ list($this->headers, $this->body) = array_pad(explode("\r\n\r\n", $response, 2), -2, "");
if($response == "") {
// var_dump(" -------------------------------");
// var_dump(" ERROR EMPTY SERVER RESPONSE");
Please sign in to comment.
Something went wrong with that request. Please try again.