Skip to content

Instantly share code, notes, and snippets.

@itskenny0
Created August 19, 2016 08:10
Show Gist options
  • Save itskenny0/097e8b6df2ccc6890a50126dcd1ea576 to your computer and use it in GitHub Desktop.
Save itskenny0/097e8b6df2ccc6890a50126dcd1ea576 to your computer and use it in GitHub Desktop.
wit.ai speech recognition in PHP
<?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;
@armanokka
Copy link

THANK YOU VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@salmanzafaransari
Copy link

getting blank object including text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment