• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fatal error call to undefined function

#1
[eluser]tim1965[/eluser]
Hi

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

<?php

class test2 extends Controller {

function index()
{
parent::Controller();
$this->load->helper(array('form', 'url','date'));
$this->output->enable_profiler(TRUE);





//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 = "http://maps.google.com/maps/geo?q=".$address."&output=csv&key;=".$key;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);
curl_close($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);
}
}
}

?&gt;

#2
[eluser]tomcode[/eluser]
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())

#3
[eluser]tim1965[/eluser]
Aagh

Sry bout that missed that in the manual, thnx


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.