David, I am doing similar calls on my site and I found (with much help from this community) that a very simple PHP script as a proxy solved my problems.
Here is my map: http://www.udfcd.org/FWP/LDAD/gmap.html If you click on the Archived ALERT tab and click Update Map with the default options you will see it in action. I use the this, 'GDownloadUrl("xmlproxy.php?type=rainarchive&ME=" + ME + "&DE=" + DE + "&YE=" + YE+ "&HE=" + HE, function(data)' instead of a direct call to the XML file. I pass the date and time variable information from the HTML form to the javascript function and let the PHP script do the legwork for reading the XML file and storing it locally. Here is the relevent part of the PHP script: <?php if ($_GET['type'] == "rainarchive") { $url = "http://alert2.udfcd.org/cgi-bin/reportgen.new?TPT=tpt/ xml_rain.tpt&CFG=lst/fslrain.lst&TIM=tim/xml_rain.tim&YE=" . $_GET ['YE'] . "&ME=" . $_GET['ME'] . "&DE=" . $_GET['DE'] . "&HE=" . $_GET ['HE']; } //fetch XML feed from posted url $ch = curl_init(); $timeout = 60; $userAgent = $_SERVER['HTTP_USER_AGENT']; $header[] = "Content-type: text/xml"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header ); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); $response = curl_exec($ch); if (curl_errno($ch)) { $fl=fopen($logfile, "w"); fwrite($fl, curl_error($ch) . " url: " . $url); //write contents of error to log file fclose($fl); } else { curl_close($ch); echo $response; } ?> I'm a weekend programmer and I was able to get this working for me with the help of this group. If others see a better way to do this I'm open to suggestions as well. Good luck! Chad On Dec 8, 8:19 am, David Miao <[EMAIL PROTECTED]> wrote: > Dear larry and all, > > I appreciate very much your valuable suggestions. Could you please > give me more detail suggestions how to modify my code if using Json to > call the xml data from the url "http://www.google.com/ig/api? > weather=61801"? since I am not very familar with network stuff. With > view source, you can see the code > fromhttp://abe-research.illinois.edu/Faculty/grift/Research/EBI/xhr-reque.... > I thank you again for your help. Have a good day! > > Sincerely, > > David > > On Dec 8, 12:37 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > On Dec 7, 7:10 pm, David Miao <[EMAIL PROTECTED]> wrote:> Dear Sir/Madam, > > > > I am asking for help to solve the question of Firefox cross site > > > domain. I am trying to develop a simple program to show weather info > > > on my map. I modified the program from Mr. Mike Williams' tutorial. > > > The program works very well for IE but not for Firefox. With IE, the > > > program shows three marks and weather infowindow when clicking the > > > markers. I guess it is the problem of Firefox cross-site. I spent days > > > and can not get it done. Any comments and suggestions are welcome. > > > > Link:http://abe-research.illinois.edu/Faculty/grift/Research/EBI/xhr-reque... > > > I get the same error in IE6 and FF: > > FF: > > Error: uncaught exception: [Exception... "Access to restricted URI > > denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" > > location: "http://maps.google.com/intl/en_us/mapfiles/139e/maps2.api/ > > main.js Line: 235"] > > > IE: > > Line: 235 > > Error: Permission denied > > > due to this URL: > > var url = "http://www.google.com/ig/api?weather=61801"; > > > You know what the problem is. There is only one way to solve the > > problem with XmlHttpRequest, a proxy. There are other solutions if > > you use JSON rather than XmlHttpRequest. > > > -- Larry- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
