Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CFHTTP - password protected page

Posted on 2006-11-16
6
Medium Priority
?
726 Views
Last Modified: 2013-12-24
i have a password protected page i needed to scape data..

How can i use CFHTTP with chttpparam to get passed to login page and then onto the page with information i can scrape.
Doing CFHTTP with the correct userid/password is no problem --but is it POSSIBLE to continue afterthereon to a page which is authenticated based on a session variable which is set when a webuser is authenticated from normal browser access.

Is that at all possible?
0
Comment
Question by:eriklee
6 Comments
 
LVL 10

Expert Comment

by:js_vaughan
ID: 17963403
You would need to enter the URL of the action page, not the login page itself.

<cfhttp url="http://www.website.com" method="post" resolveurl="Yes" throwOnError="Yes">
  <cfhttpparam name="username" value="theuser" type="formfield">
  <cfhttpparam name="userpassword" value="thepass" type="formfield">
</cfhttp>

<cfoutput>#CFHTTP.filecontent#</cfoutput>
0
 

Author Comment

by:eriklee
ID: 17965238
it won't work. the page is protected with a test on a session.variable value. you can only CFHTTP to the authentication page with the above template. . .
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 17965391
I played around with cfhttp for a long time trying to get it to work on a screen scaper prog for an ssl'ed & pwd protected site and never did get something useable. I suppose a better coder might have been able.

Your best bet is to use CFX_HTTP5 available for trial at http://www.adiabata.com/Docs/Products.cfm it's 45 bucks but it is fantastic for screen scraping and maintain sessions.

With this custom tag and cf_reExtract http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm I built a fully functional app which logs into a secured site, fills out something like 140 form fields  and parses out the response info for storage in the local db. ...in about 2 weeks.
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
LVL 1

Expert Comment

by:coderWil
ID: 17967045
I would imagine...     Since a session variable is created by the foreign server...

If you can figure out where in the process the session variable is being set, you might be able to cfhttp to that page first, obtain the session setting for your connection and then cfhttp to the authentication page using the format mentioned by js_vaughan above.  

This is an untested 'guess'...  hope it helps.

William
0
 

Author Comment

by:eriklee
ID: 17970620
sidfishes

i assume you have used cfhttp5 extensively...

i ve downloaded the trial version .. i experimented with some calls to localhost sites (some external sites) but i kept getting the error:
Error: 12006. Message: Could not connect to the server. [SYSTEM] Loc: 1. The URL does not use a recognized protocol

//////////////////////////////////// sample code
<cfset crlf = chr(13) & chr(10)>
<CFSET HEADERS="Content-Type: application/x-www-form-urlencoded#CRLF#">
<CFSET BODY="proclogin=enter&userid=erlee&password=charlie123&goto=list.cfm">
<CFSET URL="http://localhost/bbs2/admin/index.cfm">

<CFX_HTTP5 METHOD="GET" URL=#URL# HEADERS=#HEADERS# BODY=#BODY# OUT="RESult">
<CFIF STATUS NEQ "OK">
   <CFOUTPUT>Error: #ERRN#. Message: #MSG#</CFOUTPUT>
   <CFABORT>
</CFIF>

0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 17982597
not seen any issues like that...But i've never tried to use it on localhost...

Can you use it to return something from a public site?

 <cfx_HTTP5 URL="http://www.google.com"
                OUT="oResult"
                  METHOD="get"
                  TIMEOUT="200000">

<cfoutput>#oresult#</cfoutput>

might be you need to set the method to get or post?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question