couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Couchdb Wiki] Update of "Getting_started_with_PHP" by NicoNam
Date Tue, 08 Dec 2009 15:54:40 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Getting_started_with_PHP" page has been changed by NicoNam.


  We'll use the following class as a structure for storing and handling responses to our HTTP
requests to the DB.  Instances of this will store response components, namely the headers
and body, in appropriately named properties.  Eventually we might want to do more error checking
based on the headers, etc.  For this example, we'll be most interested in ''CouchDBResponse::getBody()''.
 It returns either the text of the response or the data structure derived from decoding the
JSON response based on the method's only parameter, ''$decode_json''.  Inside the ''getBody''
method, we call a static method ''decode_json'' that lives in our as-yet-unwritten ''CouchDB''
class.  We'll get to that soon enough, but all it really does in this example is wrap a call
to the PHP json extension's ''json_decode'' function.
- class CouchDBResp onse {
+ class CouchDBResponse {
      private $raw_response = '';
      private $headers = '';

View raw message