473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

curl javascript form completion

Hello, can someone please tell me the correct way to use "curl" to complete
an online form? I am trying to eventually retrieve my account balance via
a cron job that will email me the parsed output of the web page that gets
returned from the curl form completion.

The page I am trying to access is https://retire.hartfordlife.com/index.html
and the html block that contains the form is:

<form method="post" name="form1"
action="https://retire.hartfordlife.com/HartfordOnline/Login"><input
type="hidden" name="target" value="MultiRole" /> <table width="100%"
border="0" cellspacing="0" cellpadding="2" bgcolor="#e2e9f1">
<tr>
<td colspan="2"><font color="#000000" face="Verdana, Arial, Helvetica,
sans-serif" size="3"><strong><font size="2">Hartford<em>Online</em>
Login</font></strong></font></td>
</tr>
<tr>
<td nowrap><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">User
ID</font></td> <td><input type="text" size="18" name="user" tabindex="1"
value=""/></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">PIN</font></td> <td><input type="password" size="18"
tabindex="2"
name="password" value=""/></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="2"
bgcolor="#e2e9f1">
<tr>
<td nowrap><a tabindex="4"
href="https://retire.hartfordlife.com/HartfordOnline/ChallengePhrase"><fonts
ize="1" face="Verdana, Arial, Helvetica, sans-serif">Forgot Your
PIN?</font></a><font size="1" face="Verdana, Arial, Helvetica,
sans-serif"><br /><a tabindex="5"

href="HartfordOnline">https://retire.hartfordlife.com/Enrollment/Enroll">Har
tfordOnline
Enroll</a></font></td> <td><a tabindex="3"
href="javascript:document.forms['form1'].submit()"><img src="imgs/lock.gif"
width="13" height="16" border="0" title="ssl"><img src="imgs/login.gif"
width="39" height="16" border="0" /></a>
</td>
</tr>
</table>
</form>

I don't know how to handle the
_href="javascript:document.forms['form1'].submit()"_ but what is failing to
return the desired page is this command:

/usr/bin/curl -A "Mozilla/4.0" -F user=myuser -F password=mypasswd \
-F form1="https://retire.hartfordlife.com/HartfordOnline/Login" \
-F target="MultiRole" https://retire.hartfordlife.com/index.html \
results.html


I would really, really appreciate any help that anyone can offer about the
correct curl command to use to complete this form.

Apr 6 '06 #1
1 13224
On 2006-04-06, ynotssor <yn******@example.net> wrote:
Hello, can someone please tell me the correct way to use "curl" to complete
an online form? I am trying to eventually retrieve my account balance via
a cron job that will email me the parsed output of the web page that gets
returned from the curl form completion.

The page I am trying to access is https://retire.hartfordlife.com/index.html
and the html block that contains the form is:
[...]
I don't know how to handle the
_href="javascript:document.forms['form1'].submit()"_ but what is failing to
return the desired page is this command:
I don't think the fact that the form is submitted with a JavaScript call
to the DOM rather than by the browser's builtin way of handling an HTML
"submit" button makes any difference, fortunately. What the server gets
sent is the same, and that's the point at which curl steps in.
/usr/bin/curl -A "Mozilla/4.0" -F user=myuser -F password=mypasswd \
-F form1="https://retire.hartfordlife.com/HartfordOnline/Login" \
-F target="MultiRole" https://retire.hartfordlife.com/index.html \
> results.html


I would really, really appreciate any help that anyone can offer about the
correct curl command to use to complete this form.


I think I got most of the way there with this:

curl -A "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.7.12) Gecko/20050920 Firefox/1.0.7" \
-d "target=MultiRole&user=bla&password=bla" \
https://retire.hartfordlife.com/HartfordOnline/Login > results.html

Try it with your real username and password (where I've put "bla"). Your
abbreviated user agent string may well be fine, but to be on the safe
side I used exactly the same thing Firefox was using.

You probably also will need to add the options "-a ./cookies -b
../cookies" because you may need cookies when it comes to actually
interacting with the site properly.

I think you want -d for the postdata, not -F. -F is for
multipart/form-data data which is a different data format (usually used
for file uploads). This form is just an urlencoded one, for which you
use -d.

A really good way of figuring these out is to use Firefox's "Tamper
Data" extension, which lets you see exactly what it submitted to the
server and exactly what came back.
Apr 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: D Benfer | last post by:
Hi all, Im a bit thrown by curl. I want to submit some order data on an ecommerce site via a form to a php page, where the data is saved to a database. Then I want to use curl to submit the form...
9
by: Dave Martin | last post by:
I've successfully used CURL to maneuver around and through sites but a new site I've been trying to work with has got me stumped. To retrieve the data I'm trying to get a login is required. If...
9
by: Conrad F | last post by:
Hi, If any Microsoft people are listening.... Are there any plans for the new web language called "Curl" to be supported in .NET (ASP.NET)? I ask as Curl represents the first step to true OO...
6
by: Wescotte | last post by:
I'm writing a tiny php app that will log into our bank of america account and retrieve a file containing a list of checks that cleared the previous day. The problem I'm running into is when I...
0
by: existatus | last post by:
In a form there are entries like this: <input type="text" name="first_name" size="24" /> <input type="text" name="last_name" size="24" /> <input type="hidden" name="must_have" value="12345" />...
1
by: c1pkw | last post by:
Hi there, I’m having a real heap of trouble with PHP and cURL My aim is to use this code (or something like it) to submit 2 fields to a remote server (using GET) and receive back 6 fields...
3
by: adamalton | last post by:
Hi, I am using cURL with php to submit a form to a website and then retrieve the page that comes back. That part is easy. The problem is that the site I am posting the request to displays a...
1
by: Teamwolf | last post by:
Hi, I am currently finishing integration with a third party payment gateway and my own bespoke shopping cart. Currently:- My checkout process page adds all the order and customer data to my...
7
by: h.stroph | last post by:
Greetings, I apologize for my lack of literacy with php, but am wondering if someone will tell me how to use the curl php functions to navigate to the page that results from entering the login...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.