1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<?php
//connexion à la base
$couch_dsn = "http://localhost:5984/";
$couch_db = "test";
require_once "PHPOnCouch/Couch.php";
require_once "PHPOnCouch/CouchClient.php";
require_once "PHPOnCouch/CouchDocument.php";
$client = new CouchClient($couch_dsn,$couch_db);
//obtenir un document par son id
try {
$doc = $client->getDoc('0752ae2f0a0dbd8aec153c1f35000a0d');
} catch (Exception $e) {
if ( $e->code() == 404 ) {
echo "Document not found\n";
} else {
echo "Error: ".$e->getMessage()." (errcode=".$e->getCode().")\n";
}
exit(1);
}
print_r($doc);
?> |
Partager