Created
August 19, 2016 08:10
-
-
Save itskenny0/097e8b6df2ccc6890a50126dcd1ea576 to your computer and use it in GitHub Desktop.
wit.ai speech recognition in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* wit.ai speech recognition in PHP */ | |
$request = curl_init('https://api.wit.ai/speech'); | |
$headers[] = 'Authorization: Bearer YOURAPIKEY'; | |
$headers[] = 'Content-Type: audio/wav'; | |
curl_setopt($request, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($request, CURLOPT_POSTFIELDS, file_get_contents("soundfile.wav")); | |
curl_setopt($request, CURLOPT_HTTPHEADER, $headers); | |
curl_setopt($request, CURLOPT_RETURNTRANSFER, true); | |
$return = curl_exec($request); | |
echo $return; |
getting blank object including text.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
THANK YOU VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!