Solved

CFHTTP - password protected page

Posted on 2006-11-16
6
707 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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 125 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

Don't Miss ATEN at InfoComm 2017!

Visit booth #2167 to see the  new ATEN VM3200 32 x 32 Modular Matrix Switch. Other highlights include the VE8950 4K HDMI Over IP Extender, VS1912 12-Port DP Video Wall Media Player  and VK2100 ATEN Control System. Register now with Free Pass Code ATEN288!

Question has a verified solution.

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

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…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

734 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