Reputation: 901
I need to manipulate each line of a cfhttp.filecontent I got from a get:
<cfhttp url="www.internet.com/file.html" method="GET" resolveurl="false"></cfhttp>
<cfoutput>
#cfhttp.FileContent#
</cfoutput>
How would I loop through cfhttp.filecontent line by line?
Thanks!
Upvotes: 1
Views: 2089
Reputation: 9616
Another option (if you're using ColdFusion 9) is to write the content of the CFHTTP
request to a file on disk, and then use the file
attribute of cfloop
to loop over the file line by line.
Upvotes: 0
Reputation: 28873
Typically you can use list functions with some combination of chr(10) and/or chr(13) as the list delimiter. But it all depends on how "lines" are defined in your content.
<cfoutput>
<cfloop list="#cfhttp.FileContent#" delimiters="#chr(10)#" index="line">
#line#<br>
</cfloop>
</cfoutput>
Upvotes: 5