Skip to content

Commit 03e2508

Browse files
authored
Use environment variables in PHP sample
1 parent 3c864df commit 03e2508

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Samples-Http/PHP/TTSService.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
// New unified SpeechService key
1717
// Free: https://azure.microsoft.com/en-us/try/cognitive-services/?api=speech-services
1818
// Paid: https://go.microsoft.com/fwlink/?LinkId=872236
19-
$AccessTokenUri = "https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken";
20-
$apiKey = "Your api key goes here";
19+
$region = getenv('MYREGION');
20+
$AccessTokenUri = "https://".$region.".api.cognitive.microsoft.com/sts/v1.0/issueToken";
21+
$apiKey = getenv('MYKEY');
2122

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

42-
$ttsServiceUri = "https://westus.tts.speech.microsoft.com/cognitiveservices/v1";
43+
$ttsServiceUri = "https://".$region.".tts.speech.microsoft.com/cognitiveservices/v1";
4344

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

0 commit comments

Comments
 (0)