Hi,
I have this code:
PHP Code:
class PostcodeSearch{
public function get_distance($from, $to){
$xml = new SimpleXMLElement(
sprintf(
'http://maps.google.com/maps/api/directions/xml?origin=%s&destination=%s&sensor=false',
urlencode($from),
urlencode($to)
)
);
$distance = 0;
if('OK' === (string)$xml->status){
$query = $xml->xpath("route/leg/distance/value/text()");
if(0 < count($query)){
$distance = (int)$query[0];
}
}
return $distance;
}
}
And then i call the code like this:
PHP Code:
$review = Review::searchAllReviewsByTitlePoscodeAndAddress();
while($row = mysql_fetch_array($review)){
$text = strip_tags($row['body']);
$intro = substr($text, 0, 600);
$pcode = PostcodeSearch::get_distance($_GET['search'], $row['postcode']);
}
Thats all i have, any ideas what it might be?
That error points to this line:
PHP Code:
public function get_distance($from, $to){
$xml = new SimpleXMLElement(
sprintf(
'http://maps.google.com/maps/api/directions/xml?origin=%s&destination=%s&sensor=false',
urlencode($from),
urlencode($to)
)
[B]);[/B]
See bold closing bracket..
Bookmarks