Hi folks,
I tried to make a loop of cfhttp requests to a url and
save every CFHTTP.FileContent in a separated text
file.
The problem that I failed to run my code through a
loop while it is running good when make one cfhttp
request.
the code that caused the problem:
===================== index.cfm =====================
01 <cfquery datasource="Datasource" name="IDs">
02 SELECT CatID FROM Cats
03 </cfquery>
04
05 <html><body>
06
07 <cfloop query="IDs">
08 <cfhttp method="GET"
url="http://www.xyz.com/Cat.cfm?id=#IDs.CatID#"
resolveurl="Yes"></cfhttp>
09 <cffile action="WRITE"
file="D:\myWebRoot\ARCHIVES\#IDs.CatID#.cfm"
output="#cfhttp.FileContent#">
10 </cfloop>
11 <p> I am Finished!
12 </body></html>
=====================================================
Lines 01-03: Reading from a database to get all IDs.
Line 07: Starting a loop on IDs collected from the
query.
Line 08: CFHTTP request to a website with id of loop.
Line 09: CFFILE save the cfhttp.FileContent into cfm
file inside ARCHIVES directory.
if you deleted the loop in the previous code, it will
work successfully.
I need it with a loop!!!
any suggestion will be appreciated.
Hamid Hossain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists