Created
November 12, 2016 03:56
-
-
Save taiko19xx/139315231895ab26ae22cf0af46aec85 to your computer and use it in GitHub Desktop.
Get "MySQL In App(Azure)" connection string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.