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

  • SEARCH
  • Home
  • 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 8577419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:09:20+00:00 2026-06-11T20:09:20+00:00

I am having troble on curl functions in my codes. My CURLINFO_HTTP_CODE always return

  • 0

I am having troble on curl functions in my codes. My CURLINFO_HTTP_CODE always return 0 and when I use
curl_error($ch) it returns ‘could not reach host’. My host is ispeech and it shouldn’t have problems. Can anyone here help me out? Thanks a lot!

iSpeech.php

   class iSpeechBase{
        var $server;
        var $parameters = array("device-type"=>"php-SDK-0.3");

       function setParameter($parameter, $value){
            if ($parameter == "server")
                $this->server = $value;
            else
                $this->parameters["$parameter"] = $value;
        }

        function makeRequest(){
            $ch = curl_init();
            $url=$this->server . "/?" . http_build_query($this->parameters);

            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_TIMEOUT, 5);

            ob_start();

            echocurl_exec($ch);
            $http_body = ob_get_contents();
            ob_end_clean();

            echo curl_getinfo($ch, CURLINFO_HTTP_CODE); //return 0
            echo curl_error($ch); //return Could not reach host.

            if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200)

                if ($this->parameters["action"] == "convert")

                    return array("error" => $http_body);

            return $http_body;
        }
   }

synthesis-demo.php

require_once('ispeech.php');

  $SpeechSynthesizer = new SpeechSynthesizer();
  $SpeechSynthesizer->setParameter("server", "http://api.ispeech.org/api/rest");
  $SpeechSynthesizer->setParameter("apikey", "myapikey");
  $SpeechSynthesizer->setParameter("text", "yes");
  $SpeechSynthesizer->setParameter("format", "wav");
  $SpeechSynthesizer->setParameter("voice", "usenglishfemale");
  $SpeechSynthesizer->setParameter("output", "rest");
  $result = $SpeechSynthesizer->makeRequest();
  • 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-11T20:09:21+00:00Added an answer on June 11, 2026 at 8:09 pm

    So save faffing around with the ob buffer, you could replace

    ob_start(); 
    
    echocurl_exec($ch); 
    $http_body = ob_get_contents(); 
    ob_end_clean(); 
    

    with

    $http_body = curl_exec($ch);
    

    Also adds the space between echo and curl_exec missing from your example (although that should throw a fatal and stop execution – do you have your own error handler?)

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

Sidebar

Related Questions

I'm building a Curl web automation app and am having some issue with not
I am playing with cURL, and I am having trouble getting it to work.
Possible Duplicate: How to dial a phone number with ##? I am having troble
I'm having some trouble sending $_FILES by cURL - the files get transferred alright
I'm having trouble using curl to retrieve headers for a minority of sites. Some
I am having trouble getting cURL to run on Windows. I have downloaded a
i am trying calculate the amount but having troble with jQuery .. can you
honestly I'm having some trouble understanding the CURL options CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR. If I
I'm having plenty of trouble trying to use a certificate that has a password
I've been having some trouble getting CURL working with PHP on a server I

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.