I am trying to connect influxDB with PHP and i can say i was almost successful all thanks to Corley for developing PHP api. I am finding difficult to set the database on which my query has to be applied.
Below is the sample PHP code I am working on, How to choose the specific database from the available list of databases.?
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
use DateTime;
use DateTimeZone;
use InfluxDB\Options;
use InfluxDB\Client;
use InfluxDB\Adapter\GuzzleAdapter;
use GuzzleHttp\Client as GuzzleHttpClient;
use InfluxDB\Integration\Framework\TestCase as InfluxDBTestCase;
require 'composertest/vendor/autoload.php';
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$http = new \GuzzleHttp\Client();
$options = new Options();
$options->setUsername("xyz");
$options->setPassword("1234");
$adapter = new GuzzleAdapter($http, $options);
$client = new Client($adapter);
//I need to select database "Test"
var_dump($client->query('select * from "app-search"'));
?>
</body>
</html>