I am trying to get asynchronous callback to work for IBM Watson speech to text.
I got the curl function work
curl -X POST -u "c94c7025-09f5-4cee-94dd-8f73348b60d8":"4TOriExZooKh" \
--header "Content-Type: audio/wav" \
--data-binary @uploads/001528fe-9545-4c3f-9d0d-aec4cd61caee.wav \
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognitions?callback_url=http://34.234.215.13/callback.php&model=en-US_NarrowbandModel&profanity_filter=false&events=recognitions.completed_with_results&user_token=audio&results_ttl=10"
From my understanding is that the results or notification should be sent as POST to the call back URL
https://console.bluemix.net/docs/services/speech-to-text/async.html#create
The above code should be sending the completed results over to callback.php
callback.php
<?php
header('Content-Type:text/plain');
echo $_GET["challenge_string"];
foreach ($_POST as $key => $value)
error_log($key . "--" . $value);
The echo is for the url registration and then for any data sent over POST I am passing it into the foreach loop.
But I am not getting any data or results at all after the conversion is done.
access log
[14/Oct/2017:00:22:39 +0000] "POST /callback.php HTTP/1.1" 200 166 "-" "Jersey/2.22.1 (Apache HttpClient 4.5)"
error log
[:error] [pid 2046] [client 169.48.114.147:54645] PHP Notice: Undefined index: challenge_string in /var/www/html/callback.php on line 10
I am not able to understand what is wrong? I was able to get it work when I make synchronous calls ie one POST after another.