Here's a bit of PHP that you can execute on your own domain to
retrieve data from other domains:
<?php
$session=curl_init('path to remote data source here');
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response=curl_exec($session);
header("Content-Type: text/xml"); // assuming remote data is XML
format otherwise change the header appropriately
echo $response;
curl_close($session);
?>
PHP CURL reference page is here:
http://php.net/manual/en/book.curl.php
Check out the reference page for CURL options - the code snippet above
may not have options set as you require:
http://www.php.net/manual/en/function.curl-setopt.php
So create a PHP script with the above code snippet and instead of your
API code requesting data from a domain other than yours, you call the
PHP CURL script instead.
You could make the script dynamic - instead of hard coding the 'path
to remote data source here' you could pass the remote data source URL
to the script:
<?php
$data_source=$_GET['url'];
$session=curl_init($data_source);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response=curl_exec($session);
header("Content-Type: text/xml");
echo $response;
curl_close($session);
?>
So your API code could make a request for remote data from the CURL
script such as:
http://my_domain.com/my_curl_script.php?url=url_to_remote_data
Where "url_to_remote_data" is a properly encoded path to the remote
data source.
Martin.
On 6 July, 19:19, gmapsnewbie <[email protected]> wrote:
> > > Look at this:http://recenteqproject.blogspot.com/
>
> > I can't find any attempt at a map on that page. Where's the map
> > without the markers?
>
> Sorry the right path is:http://recenteqproject.blogspot.com/p/earthquake.html
>
> > > only the map is showing... the data xml file is just linked from the
> > > original file
> > > location:http://code.google.com/apis/maps/documentation/javascript/v2/examples...
>
> > I'd guess there's a cross-domain error then: you're hosting your page
> > on blogspot.com and attempting to use a GDownloadUrl from google.com.
> > But without seeing it in action it's really not easy to say.
>
> I apologize in advance if this is a dumb question but does this mean,
> we cannot just link data from other site? xml needs to reside where my
> htm resides? I am trying to create an earthquake page where live data
> constantly change. I cannot just copy xml to my site since this
> changes all the time. Can you give me a hint on a workaround pls on
> how I can get the live feed as an xml on my site and not just a feed
> on an html page? Thanks in advance...
--
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.