On 5/5/05, Andrew Scott <[EMAIL PROTECTED]> wrote: > I know I asked this question awhile ago, but I am still trying ti find a > solution as to why Coldfusion is not doing this right.
It's doing what you ask but there's a couple of errors in your code. BTW, no idea whose site choicecakes is but it has a spelling error in the main headline on the home page: Occaision (should be Occasion). > http://www.choicecakes.com.au is redirected to > pages/default.cfm?page_id=12762 The location value returned is: /pages/default.cfm?page_id=12762 but that's not a valid URL on its own - it needs http://www.choicecakes.com/au prepended to it (which is what a browser does automatically - and what CFMX would do if you specified redirect="true"). > <cffunction name="checkURL"> > <cfargument name="myURL" type="string" required="true" /> > <cfhttp url="#myUrl#" redirect="false" /> > <cfset var sc = left(cfhttp.ResponseHeader.status_code,1)> This can't be your exact code because it doesn't compile. 'var' declarations must appear at the head of the function. Note also that cfhttp is an implicitly created variable so you should 'var' declare that for safety as well or, if you're using CFMX 7, use result= on cfhttp (and 'var' declare your result variable). Furthermore, if the URL being tested does not respond, the ResponseHeader can be an empty struct. You're safer testing isNumber(left(cfhttp.StatusCode,3)) to see if you got a response back (it will not be numeric if the call failed). To debug this, I just added <cfdump var="#cfhttp#"/> immediately after the <cfhttp/> tag. Hope that helps! -- Sean A Corfield -- http://corfield.org/ Team Fusebox -- http://fusebox.org/ Got Gmail? -- I have 50, yes 50, invites to give away! "If you're not annoying somebody, you're not really alive." -- Margaret Atwood --- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
