From: bemall on 29 Oct 2008 12:43 Google weather APi returns an XML file that I would like to process and store content into a database. You can view sample xml file by entering this in your browser ..http://www.google.com/ig/api?weather=chicago How can I go about retrieveing the xml file and storing into a database ..This is wahat I have so far, let me know how to proceed since this does not work .. <!--- Set the URL address. ---> <cfset urlAddress="http://www.google.com/ig/api?weather=chicago"> <cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/> <cfset xmlDoc = XmlParse(CFHTTP.FileContent)><!--- THIS DOES NOT RETURN ANY CONTENT????. ---> <!--- Get the array of resource elements, the xmlChildren of the xmlroot. ---> <cfset resources=xmlDoc.xmlroot.xmlChildren> <cfset numresources=ArrayLen(resources)> <cfloop index="i" from="1" to="#numresources#"> <cfset item=resources[i]> <cfoutput> [B]<a href=#item.url.xmltext#>#item.title.xmltext#[/B]</a><br> [B]Author[/B] #item.author.xmltext#<br> [B]Applies to these products[/B]<br> <cfloop index="i" from="4" to="#arraylen(item.xmlChildren)#"> #item.xmlChildren[i].xmlAttributes.Name#<br> </cfloop> <br> </cfoutput> </cfloop>
From: Ian Skinner on 29 Oct 2008 12:54 bemall wrote: > <!--- Set the URL address. ---> > <cfset urlAddress="http://www.google.com/ig/api?weather=chicago"> > <cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/> > > > <cfset xmlDoc = XmlParse(CFHTTP.FileContent)><!--- THIS DOES NOT RETURN ANY > CONTENT????. ---> It does for me! Have you confirmed that the ColdFusion server can access the URL.
From: bemall on 29 Oct 2008 13:06 <!--- Set the URL address. ---> <cfset urlAddress="http://www.google.com/ig/api?weather=chicago"> <cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/> <cfset xmlDoc = XmlParse(CFHTTP.FileContent)> <cfoutput>#xmlDoc #</cfouput> Does this return content for anyone elsse ??
From: Ian Skinner on 29 Oct 2008 13:15 bemall wrote: > <!--- Set the URL address. ---> > <cfset urlAddress="http://www.google.com/ig/api?weather=chicago"> > <cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/> > > <cfset xmlDoc = XmlParse(CFHTTP.FileContent)> > <cfoutput>#xmlDoc #</cfouput> > > Does this return content for anyone elsse ?? > Put <cfoutput>#cfhttp.filecontent#</cfoutput> before the <cfset...> line and see what is actually being returned from your request. It might be an error message or some other content that is not XML formated.
From: bemall on 29 Oct 2008 16:57 This returns a blank as well .. <!--- Set the URL address. ---> <cfset urlAddress="http://www.google.com/ig/api?weather=chicago"> <cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/> <cfoutput>#cfhttp.filecontent#</cfoutput>
|
Next
|
Last
Pages: 1 2 Prev: send XML data for credit card processing Next: CFDocument, pdf and justify, oh my! |