Virtual Hosts with Jboss / Apache / ColdFusion March 25, 2009
Posted by scoopseven in ColdFusion, Linux, MediaPost.add a comment
ServerName www.mysite.comServerAlias sitetwo #added this line to Apache .conf file.
<jboss-web><context-root> /</context-root><virtual-host>www.mysite.com</virtual-host><virtual-host>sitetwo.mysite.com</virtual-host></jboss-web>
Spidering and Saving Images with CFHTTP and CFFILE March 11, 2009
Posted by scoopseven in ColdFusion, Linux, MediaPost.add a comment
Goal: To spider a site (our own site) and save all image files from the pages on that site to a hard disk on another server.
Thanks to Ben Nadel for showing me the way on this one. For some reason the path/file attributes on cfhttp were not allowing me to save a image file to the hard disk on our linux (CentOS) server. I thought I could save the file using cfcontent somehow, which led me to Ben’s post. Never thought to just save the binary stream using cffile. Not sure if there was a permissions problem or what, but here’s the work-around.
<!— Grab the image file. —>
<cfhttp
method=”get”
url=”http://www.myurl.com/someimage.jpg”
useragent=”#CGI.http_user_agent#”
getasbinary=”yes”
result=”objGet” /><!— Save the image file. —>
<cffile action=”write”
output=”#objGet.FileContent#”
mode=”777″
file=”/mypath/myimage.jpg”>
This worked like a charm. Again, not sure if this was cfhttp doesn’t support the “mode” attribute or what, but it helped immensely. Thanks, Ben.