Skip to main content
Inspiring
September 30, 2008
Question

CFHTTP problem

  • September 30, 2008
  • 4 replies
  • 1463 views
Evening all,

I have apage that uses cfhttp to post data to a fulfillment script on another site. The other site has recently upgraded their server O/S and the http post is no longer being received by them.

We have successfully tested sending form data via a standard form post using an enctype of application/x-www-form-urlencoded. If we do a standard form post using an enctype of multipart/form-data they do not receive the post, so I am assuming we need to use application/x-www-form-urlencoded.

How would I emulate this in cfhttp? I understand that we need to post an http header. Is this what the an enctype of application/x-www-form-urlencoded would do for me?

Thanks in advance.

Paul
    This topic has been closed for replies.

    4 replies

    Participating Frequently
    September 30, 2008
    I'm talking about your CF server. The one doing the <cfhttp>. Are you sure that server (the one running Coldfusion, doing the cfhttp) is posting to the correct IP address?
    Inspiring
    September 30, 2008
    The server is doing the post as far as I can tell - but to the URL, not an IP.
    Participating Frequently
    October 1, 2008
    I'm not making myself clear.

    When you do a cfhttp in coldfusion, to a domain, the server goes through the process if looking up an IP address to match to that domain name. If there's an entry, on the CF server, for that domain name in the hosts file, and it's giving the wrong IP address, that could be the problem.

    Or, if the DNS server that the CF server is setup to talk to is caching a bad IP address.

    Basically, I'm asking, are you sure that, on the CF server, that domain (that you're cfhttp'ing to) is mapping to the right IP address?
    Participating Frequently
    September 30, 2008
    Is there by chance an entry in the hosts file on the server for this hostname you're trying to post to? Maybe they changed the IP address in the process of their upgrades...

    If you try to post to that URL when you're on the server, does it work?
    Inspiring
    September 30, 2008
    Kronin555,

    I have no access to the server and the other company are adamant that the problem is at our end.

    If they changed the IP address in the process of their upgrades, then surely the form submitting to the same URL would also have the same problems would it not?

    It is so strange - cfhttp post is just not getting to them, and returns an invalid hostname error.
    Inspiring
    September 30, 2008
    Oh, and did you read the docs vis-a-vis CFHTTP &
    application/x-www-form-urlencoded?

    http://livedocs.adobe.com/coldfusion/8/Tags_g-h_09.html

    --
    Adam
    Inspiring
    September 30, 2008
    Can you pls post your code.

    --
    Adam
    Inspiring
    September 30, 2008
    Adam,

    My code is below. I tried tacking on an output of the cfhttp.FileContent and it returns the result as an error (Bad Request (Invalid Hostname)). This should not be the case as when I post the data directly the page in the URL below, it works just fine.

    I just read the link you posted and if I understand correctly CF will automatically use application/x-www-form-urlencoded unless the form data contains file data? If this is the case, my form just contains text data from the formfields and so should submit correclty, but it does not.

    Paul