Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9030461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:29:49+00:00 2026-06-16T07:29:49+00:00

I am quite experienced in PHP but I’ve always had troubles with connection between

  • 0

I am quite experienced in PHP but I’ve always had troubles with connection between servers like “post”. I have a FLAC audio file that I need to post to Google’s Speech Recognition API server. I don’t know neither how to “listen” to its response. I would like a script like that, assuming that this kind of function exists :

<?php

   $fileId = $_GET['fileId'];
   $filepath = $fileId . ".flac";
   recognize($filepath);

  function recognize($pathToFile) {

      //It's the following function that I'm looking for 
      $response = $pathToFile->post("http://www.google.com/speech-api/v1/.....&client=chromium"); 

      //The $response would be the short JSON that Google feed back.
      echo $response;

  }

?>

EDIT

I’ve followed a tutorial to create a Shell Script that posts my FLAC file using Wget –post. I would like to post like this, but in PHP. Also, at the end of the command, there is this > answer.ret line, so that Google’s answer would be written to this file. I was wondering if there was an alternate method to it in PHP.
Here’s the command line :

wget -q -U "Mozilla/5.0" --post-file audio1.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=fr-fr&client=chromium" > trancription1.ret

EDIT 2

I figured out how to do it, with @hakre ‘s answer and baked up a little Gist for curious people. Here it is: https://gist.github.com/chlkbumper/4969389. Don’t forget that the FLAC file must be a 16k bitrate FLAC

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:29:50+00:00Added an answer on June 16, 2026 at 7:29 am

    A POST request is just a standard HTTP request, just with the POST method specified. The rest of the HTTP Request and HTTP Response is pretty much the same.

    You get the response of a request in form of a HTTP Response btw.. It is absolutely normaltiv defined in RFC 2616 – just relate to this document and it explains everything.

    A function in PHP to send HTTP requests is file_get_contents, it returns the requests response. This is done via the HTTP stream wrapper that offers some options you need to send a POST request (default is GET). See HTTP context options.

    Another popular PHP extension for sending HTTP requests are the Curl bindings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I'm quite experienced with PHP but I have no idea what the keyword
I'm quite experienced in PHP but I don't quite use mod_rewrite (although I should).
I have been trying my hand at php for quite some time but dont
I have quite some experience with php, but I am very new to using
Quite experienced but self taught with PHP/MySQL and playing about with Rails. Really love
I’m quite new to CI but have lots of experience with PHP and I
Quite some time i`ve learnt MVC. I have seen various techniques to post data
I have quite a few years experience of developing PHP web applications, and have
I was going to do something with PHP, but it was quite a hassle
Quite embarrassing really, but I tested creating a database from a spreadsheet with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.