0

I am getting "PHP Fatal error: Call to undefined function http_get()"

Why is PHP not recognizing http_get();

    <?php 
$response = http_get("https://www.google.com/recaptcha/api/siteverify?", array(
  'headers' => array(
    'Accept' => 'application/json'
  )
), $info);

print_r($info);
?>
kirill2485
  • 377
  • 1
  • 5
  • 22
  • Check `phpinfo()` -- do you have the HTTP extension installed? – Michael Berkowski Dec 27 '14 at 00:59
  • `http_get()` was part of the old PECL HTTP extension. The newer version of that extension is extremely different from the old one, and I don't know that it still implements a `http_get()` function – Michael Berkowski Dec 27 '14 at 01:01
  • see here for trouble shooting information with that error: http://stackoverflow.com/a/12784048/367456 – hakre Dec 27 '14 at 01:02
  • @MichaelBerkowski http://emberstudios.azurewebsites.net/files/phpinfo.php – kirill2485 Dec 27 '14 at 01:03
  • @hakre That link does not answer my question. What extension is missing? – kirill2485 Dec 27 '14 at 01:04
  • @kirill2485 Doesn't look like you have the HTTP extension installed. If you are just looking for HTTP functionality, I would recommend looking into [Guzzle](http://guzzle.readthedocs.org/en/latest/), which is a really nice HTTP client for PHP. You do have the curl extension installed, which can do more than the old PECL HTTP v1. Otherwise, if you must use `http_get()`, you will need to install the HTTP extension v1 http://pecl.php.net/package/pecl_http – Michael Berkowski Dec 27 '14 at 01:06
  • Your question is "Why is PHP not recognizing http_get();" - this has been answered already. Especially the part how you find out the extension that is missing is explained there. However, it requires reading. That is different to just pushing a question in, you must actually read what is written there. And it requires you to look that function up in the PHP manual. Let me know if this is not suitable for you, I actually was confident you can handle that. – hakre Dec 27 '14 at 01:06
  • Look over the user-contrib notes at php.net about what changed with the HTTP extension (and how most of the documentation is now useless) http://php.net/manual/en/http.install.php – Michael Berkowski Dec 27 '14 at 01:08

0 Answers0