7

Possible Duplicate:
curl_init() function not working

I am using PHP for accessing the Foursquare API. I have set up everything for the authentication with Foursquare. But as soon as I click on the "Allow" button, my callback.php gives me the following error:

Fatal error: Call to undefined function curl_init() in C:\wamp\www\EpiFoursquare.php on line 119

Call Stack

Time    Memory  Function                          Location
0.0007  372592  {main}( )                         ..\callback.php:0
0.0039  571896  EpiFoursquare->getAccessToken( )  ..\callback.php:17
0.0040  572928  EpiFoursquare->request( )         ..\EpiFoursquare.php:31

Where does this error come from? I cannot find the origin. Please help me out.

Community
  • 1
  • 1
Adeel Kamal
  • 131
  • 1
  • 1
  • 8
  • 1
    The issue has nothing to do with foursquare at all. Turn on `curl` module in php. "I just dont know, why it is originating." --- why don't you read error message then?! – zerkms Apr 19 '12 at 11:31
  • sir actually I am getting this error, it say "Fatal error: Call to undefined function curl_init() in C:\wamp\www\EpiFoursquare.php on line 119" and all the necessary files are placed in the folder, like callback.php, index.php, EpiCurl.php – Adeel Kamal Apr 19 '12 at 11:37
  • 4
    `curl` is a php extension http://nz.php.net/manual/en/curl.installation.php – zerkms Apr 19 '12 at 11:42
  • I am connected to 4square web site, on callback, it must f=give me the access token. but when I echo $token["access_token"], it is empty. – Adeel Kamal Apr 19 '12 at 12:57
  • any one please help me out. error is actually "Fatal error: Uncaught exception 'EpiFoursquareBadRequestException' with message '{"error":"redirect_uri_mismatch"}' in /home/apmtpuci/public_html/4square/EpiFoursquare.php:244 Stack trace: #0 /home/apmtpuci/public_html/4square/EpiFoursquare.php(208): EpiFoursquareException::raise(Object(EpiCurlManager), false) #1" – Adeel Kamal Apr 19 '12 at 13:10

2 Answers2

12

You need to initialize the cURL extension: http://php.net/manual/en/curl.installation.php

User
  • 374
  • 3
  • 15
zerkms
  • 249,484
  • 69
  • 436
  • 539
  • I did this by enabling the php_curl.dll extension in the php.ini file (as FlatLander also mentions). Since I use WAMP Server, I did not need to do anything else, as the ssleay32.dll, libeay32.dll, and php_curl.dll files are already in the right places inside my C:\wamp\ directory. – Marty McGee Aug 23 '13 at 20:15
9
  1. remove ; from extension=php_curl.dll in php.ini ;
  2. ensure that ssleay32.dll and libeay32.dll are in Windows/system32 ;
  3. copy php_curl.dll into Windows\System32 as well.

This worked for me!

franzlorenzon
  • 5,845
  • 6
  • 36
  • 58
FlatLander
  • 1,717
  • 15
  • 21
  • I tried this but it did not work for me. I am not sure if thing have been updated in the last few years. I am using PHP 5.6.13. As above I had to remove `;` from `extension=php_curl.dll` in `php.ini`, I also had to remove `;` from `extension_dir = "ext"` in `php.ini`. – zrbecker Sep 04 '15 at 17:58