I got this from the IBM Watson speech to text documents, to send an audio file for processing:
curl -X POST -u <username>:<password>
--header "Content-Type: audio/flac"
--header "Transfer-Encoding: chunked"
--data-binary @<path>0001.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"
But how should I build that into PHP cURL? Something like this?
$headr = array();
$headr[] = 'Content-Type: audio/flac';
$headr[] = 'Transfer-Encoding: chunked';
...
$crl = curl_init('https://stream.watsonplatform.net/speech-to-text/api');
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, array("username:password"=>"myuser:mypassword","data-binary"=>"@<path>0001.flac"));
curl_setopt($crl, CURLOPT_HTTPHEADER, $headr);
What about the -x and -u?