WAV to text via MS Azure Marketplace RRS feed

  • Question

  • There is already a similar post but I'm trying to use the API through Azure Marketplace so the situation is different somehow.

    I use POST method to send the WAV data to https://api.datamarket.azure.com/Bing/speechrecognition/v1/. After sorting out authentication and required parameter locale, I just get the message below as long as I send any data to the API.

    The parameter "value" has an invalid value.

    The below are PHP codes I use for testing.

    function test_wav_to_text(){  
      $wav = '/mnt1/wav/test.wav';
      $data = file_get_contents($wav);
      if (!$data){
        return 'Failed to open wav';

      $url =  'https://api.datamarket.azure.com/data.ashx/Bing/speechrecognition/v1/BingSpeechToText';
      $query = 'locale=%27en-US%27';
      $request =  $url.'?'.$query;

      $accountKey = 'J344WaIiCYq...';

      $process = curl_init($request);
      curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
      curl_setopt($process, CURLOPT_USERPWD,  $accountKey.':'.$accountKey);
      curl_setopt($process, CURLOPT_TIMEOUT, 3);
      curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
      curl_setopt($process, CURLOPT_POST ,1);
      curl_setopt($process, CURLOPT_POSTFIELDS, $data);
      $response = curl_exec($process);
      return $response;

    I checked document but what it says are rather different from what I tried out, regarding URL, parameters etc. Can anyone help? Thank you so much!

    Thursday, June 4, 2015 12:21 AM