Quantcast
Channel: 一言多いプログラマーの独り言
Viewing all articles
Browse latest Browse all 846

PHPでApache CouchDBにアクセス

$
0
0
PHPでApache CouchDBにアクセスです。まずは、Welcomeメッセージを取得。


<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://admin:password@127.0.0.1:5984/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: application/json',
'Accept: */*'
));
$response = curl_exec($ch);
curl_close($ch);

header('content-type: application/json; charset=utf-8');
echo $response ;
?>

{
"couchdb": "Welcome",
"uuid": "12345678910",
"version": "1.6.0",
"vendor": {
"version": "15.10",
"name": "Ubuntu"
}
}

参考サイト
CouchDB for PHP developers - CRUD(Inchooさん)

Viewing all articles
Browse latest Browse all 846

Latest Images

Trending Articles