Пример #1
0
 /**
  * Make an HTTP GET request against a CouchDB server
  *
  * @param string $uri The URI to request
  *
  * @return mixed An unserialized version of the JSON response from CouchDB
  */
 public function get($uri)
 {
     $resp = parent::get($uri);
     $json = $this->getResponseBody();
     return json_decode($json);
 }
Пример #2
0
<?php

require_once './inc.php';
require_once 'Duckk/SimpleHTTP.php';
/**
 * Example of using the class with keep-alives
 * I have a vhost on my local machine that does Keep-Alives for me
 * called couchdb.local (a proxy to couch). You'll either have to make
 * that work for you or replace the hostname passed to the constructor
 */
$socket = new Duckk_SimpleHTTP_KeepAlive('couchdb.local');
$socket->setStreamTimeout(1);
$socket->get('/');
var_dump($socket);
echo "---------------second request--------------------\n";
$socket->get('/_all_dbs');
var_dump($socket);