Reputation: 57
I recently moved some applications from a ColdFusion 8 server to a new machine running ColdFusion 10.
One of my scripts is showing some very strange behavior now.
I am using cfhttp to pull the contents from an RSS feed, but the "FileContent" I am getting back from cfhttp does not match the URL I am expecting.
I confirmed the URL I'm using is valid and the XML it provides passes validation tests. The following test code should get the XML from the RSS feed and display it on the screen. I have no idea where the content it actually returns is coming from.
<cfset theFeedURL = "http://www.thonline.com/search/?q=&t=article&l=50&d=&d1=8/20/2014&d2=8/21/2014&s=priority&sd=desc&c[]=sports/local_sports*&f=rss&cacheBreaker=9876">
<cfhttp url="#theFeedURL#" result="MyRSS" resolveurl="yes"></cfhttp>
<cfoutput>#MyRSS.FileContent#</cfoutput>
Upvotes: 0
Views: 148
Reputation: 57
Thank you all for your answers, but I solved this issue. The problem was in the URL I was using to get the feed.
If you look in the query string I'm using, I have a couple items that have slashes in them (the d1, d2, and c[] variables)
While I can paste that URL in a browser as-is and get what I want, cfhttp doesn't like it that way.
I needed to use URLEncodedFormat()
to replace all of the slashes in the query string with %2F and that fixed the problem.
Upvotes: 2
Reputation: 11
Add <cfdump var="#MyRSS#" />
to your code to view as much of the transaction as possible.
If the problem persists, check out the getAsBinary='never'
attribute for CFHTTP.
https://wikidocs.adobe.com/wiki/display/coldfusionen/cfhttp
Upvotes: 0