Sagewire Logo

xmlparse() and google rss/atom feeds

4 Message(s) by 2 Author(s) originally posted in advanced cfml techniques


From: eleeana Date:   Tuesday, October 23, 2007
Whenever I attempt to parse any google rss or atom feeds the xmlparse function
says that they are invalid XML. Has anyone ever run into this before? I am
able to parse any other feed that I have tried, Google seems to be the only
issue. I am using CF7.

<CFHTTP url="http://news.google.com/?output=rss" method="get">
<CFSET myXMLDoc = xmlParse(cfhttp.filecontent)>


From: Adam Cameron Date:   Tuesday, October 23, 2007
Whenever I attempt to parse any google rss or atom feeds the xmlparse function
says that they are invalid XML.



Did you actually look at the data being returned to see if it WAS valid
XML?

When I run your code... I run into a very obvious problem (obvious if you
look at what's being returned by Google).

--
Adam


From: eleeana Date:   Tuesday, October 23, 2007
yea it helps when you remember to do the simple things :)

google sees this Cold Fusion request as a bot, adding the useragent attribute
to make it think its a normal browser request took care of it.

useragent="Mozilla/5.0 (Windows ; U; Windows NT 5.1; en-US; rv:1.8.0.1)
Gecko/20060111 Firefox/1.5.0.1"


From: Adam Cameron Date:   Tuesday, October 23, 2007
Bingo. Well done.

--
Adam



Next Message: Stats,btw 2 dates



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional