ixudra / curl

Custom PHP curl library for the Laravel 5 framework - developed by Ixudra
MIT License
561 stars 128 forks source link

Undefined function Ixudra\Curl\curl_init() #2

Closed nidhi95 closed 9 years ago

nidhi95 commented 9 years ago

Error occurred while using,

// Send a POST request to: http://www.foo.com/bar?foz=baz with arguments 'fow' = 'baw' using JSON Curl::post('http://www.foo.com/bar', array('foz' => 'baz'), array('fow' => 'baw'), true);

Error: FatalErrorException in Curl.php line 23: Call to undefined function Ixudra\Curl\curl_init()

ixudra commented 9 years ago

Curious - curl_init() is a standard PHP function and not something I implemented myself. Are you sure you have cURL installed on your server/development environment?

nidhi95 commented 9 years ago

Thank you. php_curl is not activated in my system.

ixudra commented 9 years ago

You're welcome. I hope you enjoy the package, be sure to let me know if you have additional questions or just some feedback :-)

bily-amin commented 7 years ago

Hi ixudra, there is no doc about the $response object. Please how can i retrieve exact response content?

elimentz commented 7 years ago

Your question is not entirely clear to me... In default use, the get(), post() and other methods will return the content of the response. No additional information is provided.

However, if you are not using the returnResponseObject() when building your cURL call (I think this is what you are referring to), then the response will contain a stdClass with the following fields:

    $response = Curl::to( $url )
        ->withData( $data )
        ->asJsonResponse()
        ->returnResponseObject()
        ->get();

    dd( $response );

//    {
//        content: 'Actual content goes here',
//        status: 200,
//        error: 'Error message goes here'       // Only added if an error occurs
//    }

    $content = $response->content;

I hope this clears up everything

bily-amin commented 7 years ago

Sure everything is clear. I really like the package. Thanks alot.

Mezeobidi commented 12 months ago

I'm still getting this error "Call to undefined function Ixudra\Curl\curl_init()",on my server (I'm using nginx). I have already ran sudo apt-get install php8.1-curl but only the test server is running but not same with production. I'm using digitalocean droplet, so I have both projects differently with different branches. I push to test branch differently and push to pro branch differently. What could be the cause, I have tried other options as well. Kindly help me

elimentz commented 12 months ago

Most likely the cURL extension isn't installed (correctly) on your server then. I've used this package multiple times on PHP 8.1 so I'm positive there is no problem in the package itself. Please verify the extension installation using the phpinfo() function (see the PHP manual for details) and make changes accordingly.