That's what I'm doing.  I've even taken the image path that is cfoutputed and 
hardcoded it in the CFHTTP to make sure the path was ok - and it downloads 
fine.  I might as well post the code.  You'll just have to change the URL param 
in the first CFHTTP call and the SaveToDir var.

<cfhttp url="http://"; method="GET" resolveurl="Yes" />
<cfset SaveToDir = "D:\internet\wwwroot\cf\images\">
<cfset Page = cfhttp.filecontent>
<cfset NewPage = Page>
<CFSET CRLF = Chr(13) & Chr(10)> 

<CFLOOP LIST="#Page#" DELIMITERS="#CRLF#" INDEX="TheLine">
        <cfset Search = 1>
        <cfset LinNum = 1>      

        <cfloop condition="Search EQ 1">
                <cfset ImgPos = 
REFindNoCase("<img[^>]+>",TheLine,LinNum,"true")>
                <cfif ImgPos.Pos[1] GT 0>
                        <cfscript>
                        ImgTag          = 
Mid(TheLine,ImgPos.Pos[1],ImgPos.Len[1]);
                        ImgSource       = REFindNoCase("src[ ]?=[ 
]?([\'""]([^\'""]+)[\'""]|([^\s]))",ImgTag,1,"true");
                        ImgSource       = 
Mid(ImgTag,ImgSource.Pos[3],ImgSource.Len[3]);
                        ImgSource       = 
ReplaceNoCase(ImgSource,'../','','all');              
                        </cfscript>
                        <cftry>
                                <cfoutput>#ImgSource#</cfoutput><br>
                                <cfhttp url="#ImgSource#" method="GET" 
path="#SaveToDir#" throwonerror="yes">
                                <cfset NewPage = 
ReplaceNoCase(NewPage,ImgSource,"http://localhost/cf/images/#ListLast(ImgSource,"/")#","all")>
                                <cfcatch>Error</cfcatch>
                        </cftry>
                        <cfset LinNum = ImgPos.Pos[1] + ImgPos.Len[1]>
                <cfelse>
                        <cfset Search = 0>
                </cfif>
        </cfloop>

</CFLOOP>

<cffile action="WRITE" file="#SaveToDir#\index.html" output="#NewPage#" 
addnewline="Yes">



>Are you sure they're running?  What if you put a CFOUTPUT before each
>CFHTTP that lists the image that it's about to download?
>
>cheers,
>barneyb
>
>On Fri, 03 Dec 2004 16:34:26 -0400, Andrew Spear
><[EMAIL PROTECTED]> wrote:
>-- 
>Barney Boisvert
>[EMAIL PROTECTED]
>360.319.6145
>http://www.barneyb.com/blog/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186179
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to