CodeIgniter Forums

Full Version: fatal error call to undefined function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


Not sure if this a Friday afternoon problem. I am trying to get a script for Geocoding working. I have palced it directly in my controller tofire it up and test it to see if it is ok before extending it.
It is blowing up with the above error for $ch = curl_init();
I cannot see why i cannot call a normal PHP function. I have checked the manual and it is supported in PHP 5 which i am running.
So throwing this open to the floor for help.
Controller code


class test2 extends Controller {

function index()
$this->load->helper(array('form', 'url','date'));

//Set up our variables
$longitude = "";
$latitude = "";
$precision = "";

//Three parts to the querystring: q is address, output is the format (
$key = "ABQIAAAALQaDvg8jmUudj4lXZMj3HhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTQulJ5_tOxGtJYRc_5Ppufy_W3pg";
$address = urlencode("columbia MO");
$url = "".$address."&output=csv&key;=".$key;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);

echo "Data: ". $data."<br>";
//Check our Response code to ensure success
if (substr($data,0,3) == "200")
$data = explode(",",$data);

$precision = $data[1];
$latitude = $data[2];
$longitude = $data[3];

echo "Latutide: ".$latitude."<br>";

echo "Longitude: ".$longitude."<br>";

} else {
echo "Error in geocoding! Http error ".substr($data,0,3);


El Forum

The php manual states :
Quote:To use PHP's cURL support you must also compile PHP --with-curl[=DIR] ...

Check whether You have cURL compiled (with phpinfo())

El Forum


Sry bout that missed that in the manual, thnx