hi guys,

I have the following, and i cant seem to understand whats the problem, its not showing the data from the XML file???

I guess its something small but i am overlooking something somewhere

PHP Code:
 
<?php
 
if ($_GET['lat'] != "" && $_GET['lng'] != ""){
 
$file utf8_encode("http://ws.geonames.org/findNearbyPlaceName?lat=".$_GET['lat']."&lng=".$_GET['lng']."&style=full");
 
$content false;
 
$tag "";
 
$name "";
 
$countryName "";
 
$adminName1 "";
 function 
startElement($parser$tagname$attrs) {
    global 
$content$tag$name$countryName$adminName1;
    if (
$content) {
      
$tag $tagname;
    } elseif (
$tagname == "geonames") {
      
$content true;
    }
  }
  function 
endElement($parser$tagname) {
      global 
$content$tag$name$countryName$adminName1;
      if (
$tagname == "geonames") {
        
// printf("<a href='%s'>%s</a>",trim($url),trim($name));
         
print "Name: ".$name."<br>";
         print 
"Admin Name: ".$adminName1."<br>";
         print 
"Country: ".$countryName."<br>";
         
$name "";
         
$countryName "";
         
$adminName1 "";
         
$content false;
      }
  }
  function 
characterData($parser$data) {
    global 
$content$tag$name$countryName$adminName1;
      if (
$content) {
        switch (
$tag) {
        case 
"name":
          
$name .= $data;
          break;
        case 
"countryName":
          
$countryName .= $data;
          break;
        case 
"adminName1":
          
$adminName1 .= $data;
          break;
        }
      }
    }
  
$xml_parser xml_parser_create();
  
xml_set_element_handler($xml_parser"startElement""endElement");
  
xml_set_character_data_handler($xml_parser"characterData");
  
$fp fopen($file,"r")or die("Cant open file");// The name and location of your XML file
  
while ($data fread($fp4096)) //4mb chunks recomended
    
if(!(xml_parse($xml_parser$datafeof($fp)))){
    die(
"Error on line " xml_get_current_line_number($xml_parser));
    }
    
fclose($fp);
    
xml_parser_free($xml_parser);
 }
 
?>
Any help will be great

Thanks

Kenny