Skip to main content
Inspiring
July 11, 2006
Question

CFHTTP Error Trapping

  • July 11, 2006
  • 1 reply
  • 411 views
I have a CFHTTP reference in a template and it occured to me that if the other server is down, it may bring a whole site down.

How do I trap for the possibility that <CFHTTP url=" http://2XX.1XX.88.1XX/listindex.php" method="GET"
resolveurl="No"></CFHTTP> cannot be read?

I canot afford to experiment with CFTRY and CFCATCH on this live site so exact code would be appreciated.

Thanks!
    This topic has been closed for replies.

    1 reply

    Participating Frequently
    July 11, 2006
    Hi IraMSN,
    For testing purposes, if you can't use another machine or a local copy of the cfm file, you might at least create a copy of the file and then modify it for testing. I say this without know what you're environment looks like that.

    Anyway, you might try adding the 'timeout' param to limit your exposure to the other site being down.

    http://livedocs.macromedia.com/coldfusion/5.0/CFML_Reference/Tags47.htm

    there are some discussions on this page that talk about some general instability in the cfhttp tag... there are also some related blog posts at the bottom of it:
    http://www.sagewire.org/cfml-discussion/CFHTTP-Connection-Failure-Error-68909.aspx

    hope it helps.
    IraMSNAuthor
    Inspiring
    July 12, 2006
    Hi Sagewire,

    Thank you for the reply and calling the docs to my attention <g>.

    Unfortunately we need to use CFHTTP to read some info from a JavaScript api. By using TIMEOUT =1 in CFHTTP, it displays a "Connection Timeout" in the table cell if there is no connection which is acceptable. It doesn't bring down the site. It is a chat application and if the chat server goes down for a little while, it's not critical to other site features.

    Thanks again!