Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ColdFusion Agent

Status
Not open for further replies.

khue

Programmer
Mar 6, 2001
112
US
How do I create a ColdFusion agent to go to any website and grab any *.jpg, *.gif, *.bmp image files that are free for download?
 
Hey Khue,

There are 3 steps that I see in creating something to do this. The first step would be to retrieve the web page which you can do via <cfhttp>. This will return the html page in a string (#cfhttp.fileContent#). The next step would be to parse through this string looking for references to images. Each time you find one that you want to retrieve, you'll need to extract the image url and either store it for retrieval later or download it immediately. This step will require a lot of string manipulation and you'll need to be familiar with the common string functions such as mid(),instr(),findnocase(),etc.. The last step would be the download of the images. I've never tried to do this with CF but you should be able to use the <cfhttp> tag again and just specify the image url. Once downloaded, you should be able to use <cffile> to write the image out using #cfhttp.fileContent# as the ouput for <cffile>.

This isn't a simple application but can certainly be done.

Good luck and let me know if you get stuck anywhere,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top