Skip navigation
Currently Being Moderated

This CFHTTP works under CF5 but not CF7

Dec 13, 2007 9:14 AM

Hi,

Can some one explains to me why this code works under CF5, the page is returned in fileContent, but under CF7, the fileContent only contains "connection failure", although the status is reported as "200 OK".

Also, i'd appreciate if someone could test it under CF8 and tell mes if the page is returned.

Thanks.
 
Replies
  • Currently Being Moderated
    Dec 13, 2007 11:35 PM   in reply to Claude
    hi Claude,
    same "Connection Failure" with status code 200 on CF8, i am afraid...


    ---
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2008 2:14 PM   in reply to Claude
    CFHTTP is working in CF7?.

    i got same issue. All working cfhttp call in CF5 is not working in CF7.

    Do we need to apply patches or hot fixes to server for CFHTTP work in CF7?. Please let me know.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 29, 2008 1:34 PM   in reply to Claude
    That is bug in CF7...nobody is addressing this or informing abobe.

    I can't go back to CF5 for this....


    CFHTTP working in CF7 for others?.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 29, 2008 2:20 PM   in reply to Claude
    Amm85 wrote:
    > That is bug in CF7...nobody is addressing this or informing abobe.
    >
    > I can't go back to CF5 for this....
    >
    >
    > CFHTTP working in CF7 for others?.

    Yes, just fine with no problems, same with CF 8
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 3, 2008 3:19 AM   in reply to Claude
    > Please make no mistake, CFHHTTP does work properly most of the time. The issue
    > in this thread is that for some HTTP addresses, it works well with CF5 but not
    > in CFMX.
    > See the first message in this thread, and just try the two lines code under
    > CFMX.

    Just to confirm: I can browse to the URL you're CFHTTPing just fine, but
    when I CFHTTP it (from same PC), I get "connection failure" too. So it's
    not just something you're doing wrong ;-)

    CF8 (8,0,0,176276).

    I'm not sure what to suggest by way of solution, though.

    --
    Adam
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 3, 2008 11:12 AM   in reply to Newsgroup_User
    I ran into a problem with cfhttp a while back and got some help here in the forums to come up with the following solution. I am using 6.1 and can get your cfhttp to work with the following code. Don't ask me why. Someone else can answer that, but at least it will work for you.

    <cftry><cftransaction>
    <cfhttp url=" http://www.cyberpresse.ca/apps/pbcs.dll/section?Category=CPRSS&profile =5046&mime=xml" method="GET" timeout="15">
    <cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
    <cfhttpparam type="Header" name="TE" value="deflate;q=0">
    </cfhttp>
    <!---parsing xml--->
    <cfset xmlFile = xmlparse(cfhttp.filecontent)>
    </cftransaction>
    <cfcatch type="Any"></cfcatch></cftry>
    <CFDUMP var = "#xmlFile#">

    Joyfully Yours,

    David Moore
    UpstateWeb LLC

    P.S. Do I get bonus points somewhere for actually answering one instead of just asking?
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 7:22 AM   in reply to Claude
    i got a call like this...

    <cfhttp method="post" url="#urlvar#" throwonerror="yes">
    <cfhttpparam type="formfield" name="userxml" value="#userxml#">
    </cfhttp>

    i need to add cftransaction around this? what other changes i need to make?.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 7:59 AM   in reply to Claude
    Wow. I feel very International today! Not bad for a southern redneck in the Bible Belt....
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 10:21 AM   in reply to Claude
    jeremy's code is confusing...

    i am not sure..what it really does and how it fix http call problem in CF7.

    CFHTTP call works in CF7 or what is best fix..?.

    Somebody please explain.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 10:33 AM   in reply to Amm85
    I know the answer has something to do with the timeout variable. I begged and begged on the boards for about 3 days before finding a solution a while back. We would need a super brain like Ben Forte to explain all the ins and outs of why. Anybody got like a Ben spotlight super signaler? Calling Ben!
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 10:36 AM   in reply to Claude
    Thanks jeremy...thanks for ur words

    so ..this will work?.

    <cfhttp method="post" url="#urlvar#" throwonerror="yes" timeout="15">
    <cfhttpparam type="formfield" name="userxml" value="#userxml#">
    </cfhttp>
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 11:23 AM   in reply to Claude
    Actually, I am Jeremy's Dad. Uh, I would just try and see if it worked. I claim no expertise in this, as I have stated from the beginning. I only know what I have begged, borrowed, and exchanged.

    I was using a tag from the exchange, displayRSS and added the timeout value and everything started working again. That's the best I can tell you.

    Ben? Ben? Where are you? Maybe I need a secret CF decoder ring? Cracker Jacks are just not what they used to be.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 11:27 AM   in reply to Claude
    is this bug in Sun's Java Engine?.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 11:58 AM   in reply to Amm85
    1. CFTRANSACTION has nothing to do with CFHTTP.

    2. In Claude's case the problem was (most likely) in HTTP response compression, which ColdFusion cannot handle. By adding two additional headers the compression was disabled. So, CFHTTP started to work.

    3. For Amm85. If you continue to ask questions in the same manner, you will never get the answer. Effectively you say that something is wrong. Nobody can understand what exactly you mean under "wrong". If you don't get any error, it means everything is working. It's another question that it is working in some way you don't expect, but this usually indicates YOUR problem. CFHTTP works in CF7. If you cannot access ANY Web-site on your Intranet, it may simply mean that you have a connectivity problem related to this particular computer.

    4. It is always a good idea to use the timeout parameter, especially if you are not sure what default value is set in Admin.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 12:41 PM   in reply to Claude
    Ah, wrong decoder ring. Needed Mr. Black. Sorry for the brevity, but when you don't have a clue it's all you got. I knew it had something to do with the timeout function.

    Mr. Black. How do I determine a good timeout time or is 15 just a good standard timeout time? I always pondered these things as I considered my plans for world domination.

    Seriously. I have been using 15 for my RSS feeds and sometimes, poof. They are gone and then as suddenly as they were gone - POOF - they return. Could it be this mysterious timeout variable. Does it need adjusting, monitoring, or otherwise tweaking to find the exact element of time for which it will function at its best.

    Thank you, Mr. Black.

    Jeremy's Dad

    ~~ Never take life too serious, there just aren't enough Skittles ~~
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 12:44 PM   in reply to Claude
    No, CF5 doesn't support compression either. But the server could add this feature after you moved to CF7, for example. Also, they might have changes Internet server that differently responses to presence/absence of the "Accept-Encoding" header. Some servers assume that if this header is not present, any encoding is acceptable.

    You can experiment with this trying the following scenarios:

    1. Do not send this header - will indicate your target server bahavior.
    2. Send "Accept-Encoding: gzip" - should fail in ColdFusion, if GZIP is supported by target;
    3. Send "Accept-Encoding:" - should disable encoding and ColdFusion should work
    4. Send "Accept-Encoding: bla-bla" - should receive error 406, as this is the only encoding you are going to accept and server does not support it.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 12:59 PM   in reply to Claude
    Also, the "TE" header in your case disables chunked transfer. It also can be a problem in CFHTTP. Using both "Accept-Encoding" and "TE" disables both features on the target, but it doesn't mean you have both problems.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2008 2:06 PM   in reply to Claude
    The following code perfectly works in CF8:
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2008 4:59 PM   in reply to Claude
    Hi everyone, I’m experiencing a similar prob but find that your suggested solutions don’t seem to work for me.

    On my remoteserever (CF7.02). it returns 408 Request Time-out no matter what I do. It just never connects. When submitted from my local server (cf8 developer) I get connected everytime. I have a friend with the same host (on a different server) and he has no probs cfttp’ing to this url with the same code.

    <cfhttp
    url=" http://api.clickatell.com/http/sendmsg"
    resolveurl="false"
    timeout="5"
    method="post"
    >
    <cfhttpparam type="formfield" name="api_id" value="9999999">
    <cfhttpparam type="formfield" name="user" value="aaaaaaa">
    <cfhttpparam type="formfield" name="password" value="xxxxxx">
    <cfhttpparam type="formfield" name="from" value="61400000000">
    <cfhttpparam type="formfield" name="to" value="27999100000">
    </cfhttp>

    I’m not sure if it’s a compression issue or not. I tried

    <cfhttp
    url=" http://api.clickatell.com/http/sendmsg"
    resolveurl="false"
    timeout="5"
    method="post"
    >
    <cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
    <cfhttpparam type="Header" name="TE" value="deflate;q=0">

    <cfhttpparam type="formfield" name="api_id" value="9999999">
    <cfhttpparam type="formfield" name="user" value="aaaaaaa">
    <cfhttpparam type="formfield" name="password" value="xxxxxx">
    <cfhttpparam type="formfield" name="from" value="61400000000">
    <cfhttpparam type="formfield" name="to" value="27999100000">
    </cfhttp>

    AND

    <cfhttp
    url=" http://api.clickatell.com/http/sendmsg"
    resolveurl="false"
    timeout="5"
    method="post"
    >
    <cfhttpparam type="header" name="Accept-Encoding" value="*" />
    <cfhttpparam type="Header" name="TE" value="deflate;q=0">

    <cfhttpparam type="formfield" name="api_id" value="9999999">
    <cfhttpparam type="formfield" name="user" value="aaaaaaa">
    <cfhttpparam type="formfield" name="password" value="xxxxxx">
    <cfhttpparam type="formfield" name="from" value="61400000000">
    <cfhttpparam type="formfield" name="to" value="27999100000">
    </cfhttp>

    As per http://www.talkingtree.com/blog/index.cfm/2004/7/28/20040729/

    and

    your suggestions only to note that none of these suggestions permitted a successful connection from my remote host. They all connect immediately from my local host.

    I also noted Dan’s quote:
    “After some more testing, it appears CFMX 7 reports the user agent string of "CFSCHEDULE" and not "ColdFusion". This means you should also add the "CFSCHEDULE" string along with the string "ColdFusion" to your MIME type exceptions list. “

    From:
    http://blog.pengoworks.com/index.cfm/2006/3/13/CFHTTP-Connection-Failu res-issues-with-Gzip

    I’m not sure of the syntax to do this or if the GZIP stuff is even relevant to my server. (Yep, I’m with Godaddy)


    Anyone???
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points