Hi.

You've found the cross domain data source browser security
restriction.
That is you map can only load data such as XML from the domain that is
hosting it.

If your webserver has PHP and supports the cURL library then you can
workaround this restriction with a proxy script:

<?php

$request='http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/
sonHafta.xml';

$session=curl_init($request);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
header('Content-Type: text/xml');
echo $response;
curl_close($session);

?>

You could save that as myproxy.php (on your own server) then in your
map code:

GDownloadUrl("myproxy.php", function etc etc

More info here:

http://uk.php.net/manual/en/intro.curl.php

Martin.


On Nov 23, 10:25 am, Cengizhan Peker <[email protected]> wrote:
> Hello All,
> I need to load an XML file from a website.
>
> I'm using
> *GDownloadUrl("sonHafta.xml", function(data) code and it works correctly.*
> *but whem i'm trying to use*
> *
> *
> *GDownloadUrl("http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/sonHafta.xml"*
> *
> *
> *nothing happens.*
> *I'm very new at Google Maps developing*
> *
> *
> *All Of Codes,*
> *
> *
> *  *  <script type="text/javascript">
>  function initialize() {
>       if (GBrowserIsCompatible()) {
>         var map = new GMap2(document.getElementById("map"));
>
> map.addMapType(G_PHYSICAL_MAP);
> map.addMapType(G_SATELLITE_3D_MAP);
>         map.addControl(new GLargeMapControl());
>         map.addControl(new GMapTypeControl());
> map.setCenter(new GLatLng(39.614495, 30.341861), 5);
> map.enableGoogleBar();
>
>         
> GDownloadUrl("http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/sonHafta.xml";,
> function(data) {
>           var xml = GXml.parse(data);
>           var markers =
> xml.documentElement.getElementsByTagName("earhquake");
>           for (var i = 0; i < markers.length; i++) {
>             var latlng = new
> GLatLng(parseFloat(markers[i].getAttribute("lat")),
>
> parseFloat(markers[i].getAttribute("lng")));
>             map.addOverlay(new GMarker(latlng));
>           }
>         });
>       }
>     }
>
>   </script>
> Am I need some extra codes to load XML from another website?
> I'm working at localhost right now.
>
> Best Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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