简体   繁体   中英

http_post_fields() fails after installing pecl_http

I just installed pecl_http with the default options and added the line "extension=http.so" to my active php.ini configuration file, but when I run my script I'm still getting

Call to undefined function http_post_fields()

Any ideas on what I can check to fix the problem?

Here's the code:

    $url = "http://localhost/elistings/public/dynamicSearch.php";
    $data = array("phone_number" => "",
               "business_name" => "name",
               "business_address" => "my address",
               "city_and_state" => "city, CA",
               );

$response = http_post_fields($url, $data);
echo $response;

After verifying that pecl_http was successfully installed, have you tried this ?

We have to activate the module, don't modify the file /etc/php.ini, but add a file pecl_http.ini in /etc/php.d

 ; Enable pecl_http extension module extension=http.so 

restart Apache

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM