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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating a file exists before CFHTTP? 1

Status
Not open for further replies.

xtendscott

Programmer
Joined
Apr 21, 2003
Messages
276
Location
US
I am grabbing a RSS feed from my blog on another site. I was just noticing that my blog site was "down" for a short time, and created an error on my site trying to display the feed.

How can I do a quick check to see if the "domain.com/blog/rss/" feed exists before grabbing the content to display?

Thanks.

xtendscott
Web Site Design and CF Programming
 
you can use cfmail to email the server admin. just kidding.

you'll have to wrap it with cftry cfcatch. if it throws an error have it display a friendly "feed down" message.

. if it can not connect to the remote site or an element just isn't there you'll see a "Cannot resolve" message. I'm sure it'll happen on this page. he isn't broadcasting.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Thanks Bombboy,

Thats why I like it here, cause I get straightend out. I was not thinking about error catching, I was on the mindset of fileexists or IsDefined or similar. That wasn't working and the error catching is now.

Will have to put the email to the admin in the "cfcatch". Great idea. hehe.

xtendscott
Web Site Design and CF Programming
 
cfcatch and cftry are very nice. it's like wrapping each execution in a check to see if it works.

you can have 100 lines of code, if anything goes wrong the cfcatch will execute. sometimes you'll get an error connecting ,sometimes you may not get an actual error connecting, but an element might not be there... You're covered either way.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top