i have just started on php recently, i'm doing a HTTP POST operation. when i tried to preform the operation i encounter error msg from my browser: tal error: Cannot instantiate non-existent class: net_curl in /home/kelvin/apache/htdocs/php/httpPost.php on line 8. i found out i used Net_Curl so i went ahead to include the package thinking that will solve the prb. i added: include_once 'Net/Curl.php'; then i try to perform the post operation again. i encounter another error msg: Fatal error: Call to undefined function: curl_init() in /home/kelvin/php/lib/php/Net/Curl.php on line 226. i went ahead and check my Curl.php and it really have the undefined function!

does anyone face the face prb b4? anyone has any solution to it?, pls advise what should i do.

Thank You.

    I think you must write this

    include "net_curl.php";
    
    //declaration of class
    $something = new net_curl();
    

    not only

    include_once "net_curl.php";
    

      sorry, i do not get some u r saying, do u mean i need to include both

      include "net_curl.php"; (i think its include "Net/Curl.php" for my case) and
      include_once "net_curl.php";
      or i only use the first one?

      i tried, still encountered the same error msg: Fatal error: Call to undefined function: curl_init() in /home/kelvin/php/lib/php/Net/Curl.php on line 226

      is it due to my Curl.php? can anyone check wheather their Curl.php has an undefined function curl_init()??

        If curl_init() is undefined, then it's a fair guess to say that you copy of PHP doesn't have cURL. On a Windows system, it's a matter of uncommeting the php_curl.dll line. On a *nix system, check see what the Configure Command was in phpinfo() says. If --with-curl is not listed, then you'll need to do a recompile of PHP.

        As the manual says:

        Requirements
        In order to use the CURL functions you need to install the CURL package. PHP requires that you use CURL 7.0.2-beta or higher. PHP will not work with any version of CURL below version 7.0.2-beta.

        Installation
        To use PHP's CURL support you must also compile PHP --with-curl[=DIR] where DIR is the location of the directory containing the lib and include directories. In the "include" directory there should be a folder named "curl" which should contain the easy.h and curl.h files. There should be a file named "libcurl.a" located in the "lib" directory.

          hi weedpacket, u r right, i just consult with my mentor and u says excatly what he had said. i have installed the curl package and its working well 🙂

            Write a Reply...