#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    1
    Rep Power
    0

    Problem Loggining into ASP site w/cfhttp -- HELP!


    Here is the problem. I need to log into our online payment services via CF, run a query, parse the returned html page, and finally update a database with that information. The problem is that I can't seem to login. I can login from a local html page that I submit . . . I've read some other posts here and it seems that the problem revolves around the ASP session ID? I also read that this comes in a cookie which needs to be given back to ASP on my next call? The problem is I don't think I ever get in and if I do it is never output in cfhttp.filecontent.

    Here is my code

    <!--- This script logs into cashnet and displays transaction information --->

    <cfoutput>

    <!--- First Post LOGIN TO ASP PAGE --->
    <cfhttp url="https://www.myservices.com/client/signon_process.asp" method="POST" port="443" multipart="NO" userAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" resolveurl="YES" redirect="YES">
    <CFHTTPPARAM type="HEADER" name="Host" value="www.myservices.com">
    <CFHTTPPARAM type="HEADER" name="Content-Type" value="application/x-www-form-urlencoded">
    <CFHTTPPARAM type="CGI" name="HTTP_ACCEPT" value="*/*">
    <CFHTTPPARAM type="CGI" name="HTTP_ACCEPT_LANGUAGE" value="en">
    <CFHTTPPARAM TYPE="HEADER" NAME="referer" VALUE="https://www.myservices.com/client/signon_params.asp">
    <CFHTTPPARAM type="HEADER" name="Connection" value="Keep-Alive">
    <cfhttpparam type="Formfield" value="/client/default.asp" name="return_to" >
    <cfhttpparam type="Formfield" name="operator" value="username">
    <cfhttpparam type="Formfield" name="password" value="password">
    <cfhttpparam type="Formfield" name="client" value="clientname">
    </cfhttp>
    <!--- End First Post --->

    <!--- Session/Cookie parse --->
    #cfhttp.responseHeader["Set-Cookie"]#
    <br>
    <cfset cookiename=listfirst(cfhttp.responseHeader["Set-Cookie"],"=")>
    <cfset cookievalue=listlast(listfirst(cfhttp.responseHeader["Set-Cookie"],";"),"=")>
    Cookie Name= #cookiename#
    Cookie Value= #cookievalue#
    <br>
    <!--- End Cookie Parse --->


    <!--- Once in Next Post --->
    <cfhttp url="https://www.myservices.com/client/inquiry/process.asp" method="POST" port="443" multipart="NO" userAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" resolveurl="YES" redirect="YES">
    <CFHTTPPARAM type="HEADER" name="Host" value="www.myservices.com">
    <CFHTTPPARAM type="HEADER" name="Content-Type" value="application/x-www-form-urlencoded">
    <CFHTTPPARAM type="CGI" name="HTTP_ACCEPT" value="*/*">
    <CFHTTPPARAM type="CGI" name="HTTP_ACCEPT_LANGUAGE" value="en">
    <CFHTTPPARAM TYPE="HEADER" NAME="referer" VALUE="https://www.myservices.com/client/inquiry/process.asp">
    <CFHTTPPARAM type="HEADER" name="Connection" value="Keep-Alive">

    <!--- Send Session/Cookie back to Processing ASP --->
    <cfhttpparam type="Cookie" name=cookiename value=cookievalue>
    <cfhttpparam type="Formfield" name="id" value="a_certian_number">
    <cfhttpparam type="Formfield" name="Tx_no" value="">
    <cfhttpparam type="Formfield" name="sdate" value="9/24/2003">
    <cfhttpparam type="Formfield" name="edate" value="10/24/2003">
    <cfhttpparam type="Formfield" name="date_type" value="">
    <cfhttpparam type="Formfield" name="item_code" value="">
    <cfhttpparam type="Formfield" name="ref_type" value="">
    <cfhttpparam type="Formfield" name="ref_value" value="">
    <cfhttpparam type="Formfield" name="account_no" value="">
    <cfhttpparam type="Formfield" name="Inquiry_amount" value="">
    <cfhttpparam type="Formfield" name="Client" value="Client">
    <cfhttpparam type="Formfield" name="Total" value="Total">
    <cfhttpparam type="Formfield" name="Sale" value="Sale">
    <cfhttpparam type="Formfield" name="Refund" value="Refund">
    <cfhttpparam type="Formfield" name="Reversal" value="Reversal">
    <cfhttpparam type="Formfield" name="Complete" value="Complete">
    <cfhttpparam type="Formfield" name="Incomplete" value="Incomplete">
    <cfhttpparam type="Formfield" name="Voided" value="Voided">
    <cfhttpparam type="Formfield" name="Voided" value="Voided">
    </cfhttp>
    <!--- End 2nd Post --->

    <!--- Display Output --->
    <cfset webpage=htmlcodeformat(cfhttp.filecontent)> <!--- Setting variable to page contents for parsing --->
    #cfhttp.errorDetail#
    #cfhttp.header#
    <!--- #cfhttp.filecontent# --->
    #webpage#
    <!--- End Display Output --->
    </cfoutput>

    Here is the returned header info.

    HTTP/1.1 200 OK Content-Type: text/html PICS-Label: (PICS-1.0 "http://www.rsac.org/ratingsv01.html" l on "2003.04.30T10:13-0500" exp "2008.04.28T12:00-0500" r (v 0 s 0 n 0 l 0)) Set-Cookie: ASPSESSIONIDSCRRTACS=Blahblahblah; path=/ Date: Thu, 16 Oct 2003 13:44:47 GMT Cache-control: private Content-Length: 9304 Server: Microsoft-IIS/5.0

    Any ideas???

    Tony
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    1
    Rep Power
    0
    I have a similar problem did you ever solve the session login problem with cfhttp

IMN logo majestic logo threadwatch logo seochat tools logo