Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default CFHTTP

    Hello, I need to send data from a CF page to an asp.net page for processing
    via a URL string. The ASP page takes three parameters. Those being Event
    Title, startDate and EndDate. My first attempt is to send the data via cfhttp
    and the following is the code. This does not seem to work. Any suggestions.
    <cfhttp
    url='http://miketest/_layouts/ooc_/WebForm1.aspx?Event_Title=SammyTest1&amp;Sta
    rtDate=04/10/2005&amp;EndDate=04/12/2005' method='get' delimiter=','
    resolveurl='yes' throwonerror='yes'> </cfhttp>

    cfmichael Guest

  2. Similar Questions and Discussions

    1. CFHTTP Put Method
      Scenario is one in which I am moving image files from a local laptop running CF Developer Server to a centralized CF Enterprise server. Have been...
    2. Cfhttp problem
      Im trying to loop through an array elements (in this case URLs) using cfhttp, there are several elements in the array but I can only cfhttp the...
    3. cfhttp erro
      I have been trying to read a tab delimited text file with cfhttp get and I keep getting this error - The column name '<!DOCTYPE HTML PUBLIC...
    4. cfhttp error
      Ugh - I give up. Hi. I have the following line of code: <cfhttp url='#appFullPath#temp_sfiles/#session.userid#/#name#' method='head' /> When I...
    5. CFHTTP help
      We have an in-house built publication system that creates .htm files from database content. For a specific project, I need to modify the way that...
  3. #2

    Default Re: CFHTTP

    '/' in the query string could be a problem. Try to use URLEncodedFormat().

    Mr Black Guest

  4. #3

    Default CFHTTP

    I was wondering if anyone can look at my code and see if it's incorect, because
    right now I'm passing some parameters to 2checkout and it's not working so I'm
    wondering if it's even possible to do a cfloop within an cfhttp? please let me
    know if it's possible. thanks.

    ----------- Code ------------
    <cfhttp Method="POST" URL="https://www.2checkout.com/2co/buyer/purchase"
    port="443" resolveurl="yes" redirect="yes">
    <cfhttpparam name="sid" type="FormField" value="#FORM.sid#">
    <cfloop index="loopcount" from="1" to="#ArrayLen(session.cart)#">
    <cfhttpparam name="c_prod_#loopcount#" type="FormField"
    value="#session.cart[loopcount][3]#">
    <cfhttpparam name="c_name_#loopcount#" type="FormField"
    value="#session.cart[loopcount][1]#">
    <cfhttpparam name="c_price_#loopcount#" type="FormField"
    value="#NumberFormat(session.cart[loopcount][2],'_____.__')#">
    <cfhttpparam name="c_description_#loopcount#" type="FormField" value="none">
    <cfhttpparam name="total" type="FormField"
    value="#NumberFormat(total,'_____.__')#">
    <cfhttpparam name="id_type" type="FormField" value="1">
    <cfhttpparam name="c_tangible_#loopcount#" type="FormField" value="y">
    </cfloop>
    <cfhttpparam name="sh_cost" type="FormField"
    value="#NumberFormat(FORM.shipping_amount,'_____._ _')#">
    <cfhttpparam name="demo" type="FormField" value="#FORM.demo#">
    <cfhttpparam name="card_holder_name" type="FormField"
    value="#FORM.card_holder_name#">
    <cfhttpparam name="street_address" type="FormField"
    value="#FORM.street_address#">
    <cfhttpparam name="city" type="FormField" value="#FORM.city#">
    <cfhttpparam name="state" type="FormField" value="#FORM.state#">
    <cfhttpparam name="country" type="FormField" value="#FORM.country#">
    <cfhttpparam name="zip" type="FormField" value="#FORM.zip#">
    <cfhttpparam name="phone" type="FormField" value="#FORM.phone#">
    <cfhttpparam name="email" type="FormField" value="#FORM.member_email#">
    </cfhttp>

    reya276 Guest

  5. #4

    Default Re: CFHTTP

    I'm not sure if you can put a CFLOOP inside a CFHTTP. You might build your
    CFHTTPPARAMs outside the CFHTTP.



    <CFSET params = "">
    <CFLOOP index="loopcount" from"1" to="#arrayLen(session.cart)#">
    <CFSET params = params & "<cfhttpparam name=" & Chr(34) & "c_prod_" &
    loopcount & Chr(34) & " type="
    & Chr(34) & "FormField" & Chr(34) & " value=" &Chr(34) &
    session.cart[loopcount][3] & Chr(34) & ">">
    <!--- repeat for the other cfhttpparams in the loop --->
    </CFLOOP>

    <cfhttp Method="POST" URL="https://www.2checkout.com/2co/buyer/purchase"
    port="443" resolveurl="yes" redirect="yes">
    <cfhttpparam name="sid" type="FormField" value="#FORM.sid#">
    #params#
    <cfhttpparam name="sh_cost" type="FormField"
    value="#NumberFormat(FORM.shipping_amount,'_____._ _')#">
    <cfhttpparam name="demo" type="FormField" value="#FORM.demo#">
    <cfhttpparam name="card_holder_name" type="FormField"
    value="#FORM.card_holder_name#">
    <cfhttpparam name="street_address" type="FormField"
    value="#FORM.street_address#">
    <cfhttpparam name="city" type="FormField" value="#FORM.city#">
    <cfhttpparam name="state" type="FormField" value="#FORM.state#">
    <cfhttpparam name="country" type="FormField" value="#FORM.country#">
    <cfhttpparam name="zip" type="FormField" value="#FORM.zip#">
    <cfhttpparam name="phone" type="FormField" value="#FORM.phone#">
    <cfhttpparam name="email" type="FormField" value="#FORM.member_email#">
    </cfhttp>

    jdeline Guest

  6. #5

    Default Re: CFHTTP

    I do <cfloop...>s inside <cfhttp> and it works fine. That's not the problem.
    Kronin555 Guest

  7. #6

    Default Re: CFHTTP

    The problem is that the cfhttp opens the connection and the cfhttpparam sends
    over the form fields. Everytime you loop over the cfhttpparams you are writing
    over the formfields form the last iteration of the loop. You must cloop the
    entire cfhttp statement as these will be individual connections and wont
    overwrite one another.

    I must add this does look like a bit of a backward way to communicate what
    looks like a shopping carts contents. Are you sure you need to be going about
    it in this manner?

    Stressed_Simon Guest

  8. #7

    Default Re: CFHTTP

    Simon is right on one thing, the "total" and "id_type" fields are being
    overwritten. All your other fields are fine, as they are appending the
    #loopcount# to the form field name and are therefore unique.

    I'm not sure what <cfhttp..> does when you try to call it with multiple
    <cfhttpparam..>s with the same name. Maybe you just forgot to append
    _#loopcount# to the total and id fields?

    Kronin555 Guest

  9. #8

    Default Re: CFHTTP

    Well it is a shopping cart contents, but I had to resort to this because I
    don't think I have another way of doing this without using client site
    scripting which I don't want to get into, that being said I was actually
    sending the information as a URL string but things got complicated when they (2
    checkout) started demanding that I send all the actual product information and
    since I cannot do a <cfloop> within <cflocation URL> tag, unless I can and if
    this is the case I would apperciate if you guys can provide an example of it or
    point me to some sites where I can get some examples of it. Thanks for the help
    guys.

    reya276 Guest

  10. #9

    Default CFHTTP

    I am trying to use CFHTTP's get method to read a text file.

    What I would like to do is begin reading the file at some other line than the
    first (or the second). Is there some way that I can do this?

    Thanks in advance.

    robstacey Guest

  11. #10

    Default Re: CFHTTP

    You can loop through the file and have the delimiter set to
    #Chr(10)##Chr(13)#

    If that doesn't work, reverse the order to #Chr(13)##Chr(10)# I forget
    which is which.

    You're basically looping through the windows newline characters in the
    text file.

    On Wed, 8 Jun 2005 14:03:21 +0000 (UTC), "robstacey"
    <webforumsuser@macromedia.com> wrote:
    >I am trying to use CFHTTP's get method to read a text file.
    >
    > What I would like to do is begin reading the file at some other line than the
    >first (or the second). Is there some way that I can do this?
    >
    > Thanks in advance.
    Ro Guest

  12. #11

    Default CFHTTP

    Hi All,

    I am facing some problem in calling <cfhttp tag in my application which is got
    migrated from ColdFusion 5 to ColdFusion MX unix server. The application code
    was running fine ColdFusion 5 which was a windows server. Whenever my
    application calls cfhttp tag it gives me the error "Connection Failure : Status
    Code Unavailable". The same code was running fine in one of my ColdFusion MX
    windows server. It looks to me some problem related on unix server. Also my
    application runs on secure shell environment.

    I will be very thankful if somebody from the group could provide me any help
    on this problem.

    Thanks in advance!!!

    Thanks
    Vineet


    vineet1980 Guest

  13. #12

    Default Re: CFHTTP

    Secure shell environment? Does this mean that the cfmx install is only available over port 443? So maybe port 80 (the default) is blocked by a firewall or something?
    CutterBl Guest

  14. #13

    Default Re: CFHTTP

    Could we see the code?


    BKBK Guest

  15. #14

    Default Re: CFHTTP

    Hi,

    Please find attached code snippets :
    <cfhttp throwonerror="Yes" timeout="5200" resolveurl="Yes" redirect="No"
    METHOD="POST"

    URL="#application.vars.absoluteURL#CoGenT/index.cfm?cfid=#cfid#&cftoken=#cftok
    en#"
    PATH="#application.vars.FilePath#"
    FILE="#variables.fileName#">
    <CFHTTPPARAM type="formfield" name="fuseaction" value="reports:PrintRpts">
    <CFHTTPPARAM type="formfield" name="email_format" value="HTML">
    <cfloop
    list="ReportID,rpt_CRO_ID,rpt_contract_id,WO_Typ,C RO_ID,contract_id,rpt_typ,Awar
    ded_Start,Awarded_End" index="key">
    <cfif isdefined("attributes.#key#")>
    <cfset tmp=evaluate("attributes.#key#")>
    <CFHTTPPARAM type="formfield" name="#key#" value="#tmp#">
    </cfif>
    </cfloop>
    </cfhttp>

    The above code is working fine in ColdFusion 5 in windows server. The
    application is running on secure shell environment on unix server. I have tried
    to give port no as 443 as attribute in <cfhttp tag but it doesn't worked. If
    you have any solution then please let me know.

    Thanks in advance.

    Thanks,
    Vineet

    vineet1980 Guest

  16. #15

    Default Re: CFHTTP

    > The same code was running fine in one of my ColdFusion MX windows
    > server. It looks to me some problem related on unix server.
    Here I thought immediately of case-sensitivity. Have you ruled that out?



    BKBK Guest

  17. #16

    Default Re: CFHTTP

    You will see from the
    [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000272.htm[/url] that there
    have been changes in the functionality of the tag since CF5. One example is the
    addition of the charset attribute. Setting it to "utf-8" has been known
    to cure similar problems.



    BKBK Guest

  18. #17

    Default Re: CFHTTP

    Hi,

    I have checked there is no issue with case senstivity in unix server. I have
    also tried to give charset as utf-8 which is default charset in ColdFusion MX
    and iso-8859 for ColdFusion 5 . But none of these worked. I have also tried to
    use <cfhttpparam for providing charset information but that also doesn't
    worked. I will be very thankful, if you could please provide me some pointers
    in solving this problem.

    Thanks in advance.

    Thanks,
    Vineet

    vineet1980 Guest

  19. #18

    Default Re: CFHTTP

    And [url]http://www.talkingtree.com/blog/index.cfm?mode=entry&entry=25AA75A4-45A6-2844-7CA3EECD842DB576?[/url]


    BKBK Guest

  20. #19

    Default Re: CFHTTP

    Hi,

    I tried a simple code of cfhttp and trying to read a static cfm but it gives
    me error as "Status Code Unavailable" on windows server. I am cfhttp to
    authenticate the user from My LSSO server and able to authenticate user. But
    when I am trying to read a .cfm file it is giving me a error "Connection
    Failure: Status code unavailable". I have used the below code :

    <cfhttp throwonerror="Yes" timeout="5200" resolveurl="Yes" redirect="No"
    METHOD="POST"
    URL="http://finapp1-d.am.lilly.com/porecon/footer.cfm">
    <CFHTTPPARAM type="formfield" name="fuse" value="hello">
    </cfhttp>

    Please suggest what I need to do so that code will work fine.

    Thanks in advance.

    Vineet Marwah

    vineet1980 Guest

  21. #20

    Default Re: CFHTTP

    Can you access that URL in a browser?
    I can't even PING that server

    Pinging finapp1-d.am.lilly.com [40.2.254.137] with 32 bytes of data:

    Request timed out.
    Reply from hidden.hidden.231.3: Destination net unreachable.
    Request timed out.


    DaveyS Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139