• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can I do this in coldfusion?

New Here ,
Sep 18, 2007 Sep 18, 2007

Copy link to clipboard

Copied

Hi all. I need to do the following
1. Log into a website
2. click a link
3 download a file by clicking a button (and accepting the file download in the pop up)

Can I do this in coldfusion?

TOPICS
Advanced techniques

Views

809

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 18, 2007 Sep 18, 2007

Copy link to clipboard

Copied

In theory yes, but it's not easy.

Speaking at a high level, you'll need to do the following:
1) CFHTTP POST your login credentials.
2) Analyze response for successful/unsuccessful login
3) If unsuccessful login, abort with error message
4) If successful login, capture cookie/state variables returned
5) If you know what the address of the file to download is going to be ahead of time, use CFHTTP GET (passing along all cookie/state vars explicitely) to retrieve the file and save it to disk on the CF-server

**If the address of the file to download is dynamic, you can try using CFHTTP GET to retrieve the raw HTML of the page that displays the "link" in question, and you can then use regular expression searches to locate and discover the address of the file you want to download.

I hope this helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

Hmmm. This forum is acting funky this morning. Messages appearing and disappearing.

Anyway, to be honest. I am alittle lazy and don't really want to code all this. Do applications exist which can capture the users actions, record them, then repeat them when required.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

C++ or Visual Basic would be much better langauges for this type of application. I'm sure there are applications doing this already but you might need to do some deep searching, however, instructions on how to do this are really easy to find. Here is one link that explains how to do it...

http://dn.codegear.com/article/30197

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: SilentBob'secretfusion
Hmmm. This forum is acting funky this morning. Messages appearing and disappearing.

Anyway, to be honest. I am alittle lazy and don't really want to code all this. Do applications exist which can capture the users actions, record them, then repeat them when required.



JMeter ( http://jakarta.apache.org/jmeter/ ) can actually do exactly what you're asking for. With Jmeter, you can "record" a user's session clicking around a web site, and you can save it to a "test plan". You can then re-run that "test plan" over and over again. You can also configure it to run multiple "threads" (users) performing those actions at the same time.

This tool often comes in handy for performance and load testing, but can be used for a variety of other purposes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2007 Sep 18, 2007

Copy link to clipboard

Copied

Are you talking about building a website where users can login and
download files you are hosting with the site?

This is trivial and the only part that would require actual CFML code is
the login verification. Everything else could technically be straight HTML.


Or are you asking how to use ColdFusion to login to another site and
download files from the remote site to the CF server.

That is the process Grizzly described.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

No... What I mean is can I create an application in coldfusion that doest the following:

1. Logs into a website (for example www.needreport.com)
2. Provides login credentials upon request of www.needreport.com
3. After login happens, the coldfusion application will click a link imbedded in www.needreport.com.


Basically, I need to create an application which acts like a user using a browser.

Can this be done in coldfusion, if not, does any know of an application or a language which do this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

1. Logs into a website (for example www.needreport.com)
2. Provides login credentials upon request of www.needreport.com


<cfhttp url=" http://www.needreport.com/login.cfm" method="post">
<cfhttpparam name="username" type="FormField" value="me_myself">
<cfhttpparam name="password" type="FormField" value="1243">
</cfhttp>

3. download a file

<cfhttp method="Get" url=" http://www.needreport.com/downloadPage.cfm" throwOnError="Yes" />

We assume the download file is embedded in downloadpage.cfm by means of the combination cfheader/cfcontent. In this way the host server could arrange a login and download session for you.







Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2007 Sep 19, 2007

Copy link to clipboard

Copied

Hmmm... I spoke too quick. When I got down to testing it I found that i could only download text files in this manner. Binaries give encoding problems. Will look into it some other time. Not feeling too well.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2007 Sep 22, 2007

Copy link to clipboard

Copied

LATEST
Back to my last post as promised. My first experiment with downloading binaries using cfhttp in that way led to an encoding problem.

However, I have solved it. I simply applied the functions toBinary and toBase64.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation