Skip to content

Instantly share code, notes, and snippets.

Created November 12, 2016 03:56
What would you like to do?
Get "MySQL In App(Azure)" connection string.
define('ENV_STR', 'MYSQLCONNSTR_localdb');
$return = array('result' => false);
if (isset($_SERVER[ENV_STR])) {
$connectStr = $_SERVER[ENV_STR];
$return['connection'] = array(
'host' => preg_replace("/^.*Data Source=(.+?);.*$/", "\\1", $connectStr),
'database' => preg_replace("/^.*Database=(.+?);.*$/", "\\1", $connectStr),
'user' => preg_replace("/^.*User Id=(.+?);.*$/", "\\1", $connectStr),
'password' => preg_replace("/^.*Password=(.+?)$/", "\\1", $connectStr)
$return['result'] = true;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($return);
Copy link

Can I ask which parts of this code would be changed to retreive the local web app details and connect? Are there any specific parts that I would be needing to change? thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment