Skip to content

Instantly share code, notes, and snippets.

@itskenny0
Created August 19, 2016 08:10
Show Gist options
  • Select an option

  • Save itskenny0/097e8b6df2ccc6890a50126dcd1ea576 to your computer and use it in GitHub Desktop.

Select an option

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;
@nhockm4v

Copy link
Copy Markdown

thank you very much!!!

@dura0ok

dura0ok commented Oct 14, 2019

Copy link
Copy Markdown

Thank you very much!

@armanokka

Copy link
Copy Markdown

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

@salmanzafaransari

Copy link
Copy Markdown

getting blank object including text.

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