* Object: Execute a remote query to a distributed database on nuvolabase.com (free account) using HTTP (OrientDB REST API) */ /* user configurable parameters */ $nuvolabasedb = 'db$free$demo$GratefulDeadConcerts'; $command = 'select from OGraphVertex'; $user = 'reader'; $password = 'reader'; $useragent = 'NuvolaBase PHP REST agent/v0.8 (compatible; Mozilla 4.0; MSIE 5.5; http://www.nuvolabase.com/)'; /* END of user configurable parameters */ $nuvolabasehost = 'studio.nuvolabase.com'; $url = "http://" . $user . ":" . $password . "@studio.nuvolabase.com/command/" . $nuvolabasedb . "/sql/"; $ch = curl_init(); // set user agent curl_setopt($ch, CURLOPT_USERAGENT, $useragent); // return the result or false in case of errors curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // set the target url curl_setopt($ch, CURLOPT_URL, $url); // do basic login authentication curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // howmany parameter to post curl_setopt($ch, CURLOPT_POST, 1); // the post data to send curl_setopt($ch, CURLOPT_POSTFIELDS, $command); // execute curl,fetch the result and close curl connection $res = curl_exec ($ch); curl_close ($ch); // display result if ($res !== FALSE); print_r (json_decode($res)); ?>