Skip to content

Commit

Permalink
Use environment variables in PHP sample
Browse files Browse the repository at this point in the history
  • Loading branch information
boltomli authored Jun 17, 2020
1 parent 3c864df commit 03e2508
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Samples-Http/PHP/TTSService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
// New unified SpeechService key
// Free: https://azure.microsoft.com/en-us/try/cognitive-services/?api=speech-services
// Paid: https://go.microsoft.com/fwlink/?LinkId=872236
$AccessTokenUri = "https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken";
$apiKey = "Your api key goes here";
$region = getenv('MYREGION');
$AccessTokenUri = "https://".$region.".api.cognitive.microsoft.com/sts/v1.0/issueToken";
$apiKey = getenv('MYKEY');

// use key 'http' even if you send the request to https://...
$options = array(
Expand All @@ -39,7 +40,7 @@
else{
echo "Access Token: ". $access_token. "<br>";

$ttsServiceUri = "https://westus.tts.speech.microsoft.com/cognitiveservices/v1";
$ttsServiceUri = "https://".$region.".tts.speech.microsoft.com/cognitiveservices/v1";

//$SsmlTemplate = "<speak version='1.0' xml:lang='en-us'><voice xml:lang='%s' xml:gender='%s' name='%s'>%s</voice></speak>";
$doc = new DOMDocument();
Expand Down

0 comments on commit 03e2508

Please sign in to comment.