Error php, Call to Undefined Function http_get()

Asked

Viewed 406 times

0

I looked for ways to solve this problem to use the function http_get(), all had to install the lib php-http and by pecl the http only.

I did it and I set apache2/php.ini libraries in this way:

extension=/usr/lib/php5/20121212/http.so
extension=/usr/lib/php5/20121212/raphf.so
extension=/usr/lib/php5/20121212/propro.so

I gave the command service apache2 restart and the problem still continues, does anyone know if anything else is missing? Remembering that it is in Linux Mint/Ubuntu.

  • Look here: http://httpd.apache.org/docs/current/mod/core.html and here: http://php.net/manualen/http.install.php

  • This is the previous version of: http://php.net/manual/en/function.http-get.php make: apt-get install php-http

  • I had already done all this... I even restarted the computer! But nothing has worked so far, I have the impression that it does not take the changes in php.ini, sei la.

  • I decided to uninstall and install pecl_http again and when I use the command var_dump(extension_loaded("http")); it prints TRUE, but the http_get command still doesn’t work and gives the error Fatal error: Call to Undefined Function http_get() in /home/Andre/www/get_php.php on line 5

  • I think you don’t need to do anything manually, just install already puts the "Extensions" correctly. Look here: http://php.net/manual/en/http.install.php, remove what you did and type in the terminal the command: apt-get install php5-dev && apt-get install libcurl3 && apt-get install libmagic && apt-get install php-http && pecl install pecl_http

  • That I did at the beginning of everything! It didn’t work.

  • Maybe your code isn’t using the method http_get() adequately.

  • Good evening, tested my answer?

  • Hummm... it’s been a while since it happened! I don’t really remember, but I think I solved this problem using Curl! But thank you all for your help!

Show 4 more comments

2 answers

1

According to this response from Soen and the link you have to include in the correct order, this is the order:

extension=/usr/lib/php5/20121212/raphf.so
extension=/usr/lib/php5/20121212/propro.so

;Este só deve vir depois
extension=/usr/lib/php5/20121212/http.so

If configured the --with-http-shared-deps (default) may depend on the following extensions and in this order:

extension = raphf.so
extension = propro.so

extension = hash.so
extension = iconv.so
extension = json.so

;Este só deve vir depois
extension = http.so

An example of use:

<?php
$response = http_get("http://www.example.com/", array("timeout"=>1), $info);
print_r($info);

Note that the documentation has no further data on this extension (which is PECL), although it still has a missing link http://php.net/manual/it/ref.http.php - Now only available in the links https://pecl.php.net/package/pecl_http and documentation

-1


I couldn’t solve the problem with http_get (I couldn’t configure it), so I ended up working with Curl.

Thank you all for your help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.