-
Load XML from site - works in preview, but not online???
Hi all,
I'm using a simple bit of code below to pull some info about a weather feed. When I test in Flash, it works fine, but when I test online, it doesn't work at all, and doesn't retrieve ANY data.
What is going wrong?
Code:
WEATHERXML = new XML();
WEATHERXML.load("http://www.rssweather.com/rss.php?hwvUT=C&hwvUP=mb&hwvUS=kmh&hwvUV=km&hwvCCChange=forecast&hwvSF=Y&maxdays=2&daysonly=2&hwvStyle=ce&place=johannesburg%2B%2F%2Brand&country=ZA&icao=FAGM&alt=rss20a");
WEATHERXML.onLoad = fParseXML;
-
You should...no...you must! set an onLoad handler before starting loading.
The same thing with sound, etc.
Try this. If it won't work, try to search this tremendous FAQ
Last edited by Unsteady; 03-18-2005 at 08:23 AM.
Never give up...
-
Thanks Unsteady.
Never fear though, I found that the problem was a cross-domain one, and I discovered two workarounds, one simple, one super complex!
simple: http://www.bgxcomponents.com/flashWeatherClient.htm.
super complex: http://www.macromedia.com/cfusion/kn...fm?id=tn_16520
-
I thought of it, too. My congratulations!
Never give up...
-
Perverse Futurist
Why not just use a php proxy file?
-
That's what I ended up doing actually :-)
(Well, an asp proxy)....
-
Actionscript idiot
How did you do your asp proxy? For some reason mine doesn't work. As follows:
Here's an awesome problem. I want Flash to access an outside domain XML feed, specifically my weather.com account. This can normally be done with the following code:
Code:
// FLASH CODE
var my_xml:XML = new XML();
var myLoginReply_xml:XML = new XML();
myLoginReply_xml.ignoreWhite = true;
myLoginReply_xml.onLoad = onLoginReply;
my_xml.sendAndLoad("getweather.asp", myLoginReply_xml);
and the helper asp page:
Code:
<%@ Language=VBScript %>
<%
Dim url
url="http://xoap.weather.com/weather/local/USNC0256?cc=*&dayf=4&prod=xoap&par=1012597020&key= bd646bbfde4c1efc"
Response.ContentType="text/xml"
Response.Redirect url
%>
Piece of cake right? Flash contacts the asp page, which brings in the xml feed from across the internet, so Flash thinks it it getting the original XML page. Genius. Well it doesn't work on IIS for some reason. I can get the same thing to work just fine when I rewrite the asp code to php code. But I'd prefer to know why the asp version doesn't work, and how to fix it.
I am running IIS 6 on a Windows 2003 Web Edition server if that makes a difference.
Any help would be appreciated. BTW, you can get a free weather.com XML feed account here: http://www.weather.com/services/xmloap.html
-
Actionscript idiot
Got it working:
<%@ LANGUAGE=VBScript%>
<%
Response.Buffer=True
Dim MyConnection, TheURL
' Specifying the URL
TheURL = "http://xoap.weather.com/weather/local/weather.xml"
Set MyConnection = Server.CreateObject("Microsoft.XMLHTTP")
' Connecting to the URL
MyConnection.Open "GET", TheURL, False
' Sending and getting data
MyConnection.Send
TheData = MyConnection.responseText
'Set the appropriate content type
Response.ContentType = MyConnection.getResponseHeader("Content-Type")
Response.Write (TheData)
Set MyConnection = Nothing
%>
-
...::: ANNIYAN :::...
please send a sample file for "load xml from site"...
Originally Posted by aragorn23
Hi all,
I'm using a simple bit of code below to pull some info about a weather feed. When I test in Flash, it works fine, but when I test online, it doesn't work at all, and doesn't retrieve ANY data.
What is going wrong?
Code:
WEATHERXML = new XML();
WEATHERXML.load("http://www.rssweather.com/rss.php?hwvUT=C&hwvUP=mb&hwvUS=kmh&hwvUV=km&hwvCCChange=forecast&hwvSF=Y&maxdays=2&daysonly=2&hwvStyle=ce&place=johannesburg%2B%2F%2Brand&country=ZA&icao=FAGM&alt=rss20a");
WEATHERXML.onLoad = fParseXML;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|