Hello


u have to use xml (DOM class)  and load method for this task in server side

this is the code of server side PHP script



<?php

header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
//A date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 echo '<?xml version="1.0" encoding="ISO-8859-1"?>
<person>';

$a=0;

     $str=$_GET['st'];
     if (strlen($str)>=2)
     {
  $str=str_ireplace('Delhi','Delh',$str);


  $doc = new DOMDocument();
  $doc->load("
http://maps.google.com/maps/geo?&output=xml&key=ABQIAAAApY59W0O_uJ3FKPcXTDelVhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxR-_OC5RhhpXJtarb6_apjjnNKuFQ&q=$str
");
  $city=$doc->getElementsByTagName("Point");
  $add=$doc->getElementsByTagName("Placemark");


  foreach( $city as $st )
  {
  $area = $st->getElementsByTagName( "coordinates" );
  $location = $area->item(0)->nodeValue;
  $get=  explode(',',$location);
  $lat[0]=$get[0];
  $long[0]=$get[1];
    }
    foreach($add as $d)
    {
        $d2=$d->getElementsByTagName("address");
        $d3=$d2->item(0)->nodeValue;
    }
    $d3=str_replace('&','and',$d3);
    $st2=explode(',',$d3);
    if (sizeof($st2)>1)
    $d3=$st2[0].",".$st2[1]." ".$st2[2]." ".$st2[3]." ".$st2[4];
    else
    $d3=$st2[0];

    if ((isset($lat[0])) && (isset($long[0])) && (isset($d3)))
    {
  echo "<ll>".$lat[0]."</ll>";
  echo "<ll1>".$long[0]."</ll1>";
  echo "<ddd>".$d3."</ddd>";
  echo "</person>";
      }
      else
      {
  echo "<ll>".$a."</ll>";
  echo "<ll1>".$a."</ll1>";
  echo "<ddd>".$a."</ddd>";
  echo "</person>";
        }
    }
     else
     {

  echo "<ll>".$a."</ll>";
  echo "<ll1>".$a."</ll1>";
  echo "<ddd>".$a."</ddd>";
  echo "</person>";

     }

  ?>
  cut and paste


thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to