createToken($proxyHost. ":" .$port , $region, $username);
$mysqli = mysqli_init();
//Connect to Proxy using acces token
$mysqli->real_connect($proxyHost, $username, $token, $db, $port, NULL, MYSQLI_CLIENT_SSL);
if ($mysqli->connect_errno) {
echo "Error: Failed to make a MySQL connection, here is why:
";
echo "Errno: " . $mysqli->connect_errno . "
";
echo "Error: " . $mysqli->connect_error . "
";
exit;
}
/***** Example code to perform a query and return all tables in the DB *****/
$res = mysqli_query($mysqli,"SHOW TABLES");
while($cRow = mysqli_fetch_array($res))
{
$tables[] = $cRow;
}
echo '
'; print_r($tables); echo ''; $mysqli -> close(); return json_encode($tables); }