Coldfusion, anyone?
I need to know how to implement this so it works. It parses websites for SWF filenames - absoutely perfect for the job. But how do I implement it into a website?
<!--- Find SWF files in cut and pasted source --->
<CFPARAM NAME="FORM.sourceurl" DEFAULT="">
<CFSET OutputMsg = ''>
<!--- Show form if no URL has been put in --->
<CFIF FORM.sourceurl IS ''>
<html>
<head>
<title>Find link to Flash file in Source Code</title>
</head>
<body>
<p><b>Find link to Flash files</b></p>
<p>Cut and paste URL of page with Flash file.</p>
<p>To find the URL of a pop-up, right click around the page outside the Flash animation until you get 'Properties' on the bottom of the pop-up menu, then select and copy the URL and paste it below.</p>
<form method="post" action="">
<p>URL: <input type="text" name="sourceurl" size="100" maxlength="200"></p>
<p><input type="Submit" name="Submit" value="Submit"></p>
</form>
<p>NB: May not find files which are loaded via Javascript links, but it should do.</p>
<p>If you have the source code of the page, you need the <a href="findinsource.cfm">find in source</a> page.</p>
</body>
</html>
<CFELSE>
<!--- Download the source code of the page you're interested in --->
<!--- Imitate Internet Explorer 6 for nefarious reasons --->
<CFHTTP URL="#FORM.sourceurl#"
ResolveURL = "Yes"
Method="GET"
TIMEOUT = "120">
</CFHTTP>
<!--- Process HTML code --->
<CFSET ProcessedCode = CFHTTP.FileContent>
<CFIF FindNoCase('.swf', ProcessedCode, 1) GT 0>
<CFSET ProcessStart = 1>
<!--- Look for SWFs ten times --->
<CFLOOP FROM="1" TO="10" INDEX="OverLoop">
<CFSET ThisURL = ''>
<CFIF FindNoCase('.swf', ProcessedCode, ProcessStart) GT 0>
<!--- Take where the .swf is and go back 116 characters --->
<CFSET StartURL = FindNoCase('.swf', ProcessedCode, ProcessStart) - 116>
<CFIF StartURL LT 1>
<CFSET StartURL = 1>
</CFIF>
<!--- Cut out 120 character long chunk of HTML, ending in .swf --->
<CFSET ChunkCode = Mid(ProcessedCode, StartURL, 120)>
<!--- Reverse the characters in that code, so fws. is at the start --->
<CFSET ChunkCode = Reverse(ChunkCode)>
<!--- Search for ' and " - the start of the links - first one come across will be start of link --->
<CFSET findthese = "'" & '"'>
<CFIF FindOneOf(findthese, ChunkCode, 1) GT 0>
<CFSET ThisURL = Mid(ChunkCode, 1, FindOneOf(findthese, ChunkCode, 1)-1)>
<!--- Turn URL back around the right way --->
<CFSET ThisURL = Reverse(ThisURL)>
<!--- If it's a relative URL, put right path in front of it --->
<CFIF Mid(ThisURL, 1, 7) IS NOT 'http://'>
<!--- If starts from root directory, put site domain in front of it --->
<CFIF Mid(ThisURL, 1, 1) IS '/'>
<CFSET SitePath = ListGetAt(FORM.sourceurl, 1, "/")>
<CFSET SitePath = SitePath & "//" & ListGetAt(FORM.sourceurl, 2, "/")>
<!--- If is in same directory, put domain and path in --->
<CFELSE>
<CFSET SitePath = Reverse(FORM.sourceurl)>
<CFSET SitePath = ListRest(SitePath, "/")>
<CFSET SitePath = Reverse(SitePath) & '/'>
</CFIF>
<CFSET ThisURL = SitePath & ThisURL>
</CFIF><!--- End of relative URL IF --->
<CFSET OutputMsg = OutputMsg & '<p><a href="#ThisURL#">#ThisURL#</a></p>'>
</CFIF>
<!--- Set the place to start looking as just past where a .swf was last found --->
<CFSET ProcessStart = FindNoCase('.swf', ProcessedCode, ProcessStart) + 4>
</CFIF>
</CFLOOP>
<!--- If can't find any '.swf' set a different message --->
<CFELSE>
<CFSET OutputMsg = 'No .swf files listed in source. Bad luck.'>
</CFIF>
<html>
<head>
<title>Discovered links to Flash file in Source Code</title>
</head>
<body>
<p>Found Flash (.swf) files. Right-click and 'Save Target As...' to save it to your hard drive.</p>
<CFOUTPUT>#OutputMsg#</CFOUTPUT>
<p><a href="?">Reset</a></p>
</body>
</html>
</CFIF>
I do own Dreamweaver MX 2004, not a clue how to use it, just bought it for school project.
cr3ative