0

I am doing a custom SMS gateway integration with Laravel. I used curl for that. Curl is already enabled in my localhost(XAMPP, ubuntu) and I can use curl in simple PHP. But when I try to call curl_init() in laravel leads to an error FatalErrorException in Builder.php line 311: Call to undefined function Ixudra\Curl\curl_init(). When I use var_dump(function_exists('curl_version')); , I got bool(false). How can I use curl in Larvel

Vishnu Jayan
  • 149
  • 3
  • 16
  • are you using `wamp`,`xamp` or ?_ go to `php.ini` and check whether you have enabled the `curl` by searching for `;extension=php_curl.dll` – Kalhan.Toress Aug 10 '16 at 12:30
  • 1
    are you sure the library you are using `Ixudra\Curl`, has such method `curl_init`? – Mina Abadir Aug 10 '16 at 12:36
  • why the **** are you using xampp on ubuntu? there's no auto update ,and you lose all the benefits of the ubuntu security team patches and you'll have to roll your own unattended-upgrades and trust the xampp team to provide security patches in a timely manner... which they don't (usually takes several months between releases, that includes security patches) – hanshenrik Aug 10 '16 at 13:33
  • I can use curl request in pure PHP code. But can not use that code in laravel\ – Vishnu Jayan Aug 11 '16 at 04:54

1 Answers1

0

Check php.ini for the extension=php_curl.dll and make sure it is enabled. If not,enable it and restart xampp. Check the first answer here for a sample request.

Community
  • 1
  • 1
omarsafwany
  • 3,695
  • 8
  • 44
  • 75