cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: simulate post data on html form

From: Philippe Baudry <Philippe.Baudry_at_evidian.com>
Date: Thu, 15 Feb 2007 17:15:50 +0100

curl-users-bounces_at_cool.haxx.se wrote:
>
> >>>>> "PB" == Philippe Baudry writes:
>
> PB> hi
>
> PB> emulation of html form filling with curl seems to us very
> interesting;
> PB> however i can't run this functionnality correctly
>
> PB> if we consider a very simple exemple as the input of a search
> criteria
> PB> in the google form
>
> PB> if i want to simulate the input of "red house" by exemple,
> PB> i have tryed these simple syntaxes without success
>
> Have you actually looked at the HTML source?
> Do you have the faintest idea of how the form looks,
> that you want to get filled?
> And how the form fields including the hidden ones are named?
>
> PB> curl --proxy clprox:80 --url http://www.google.fr -d "Recherche
> PB> Google"="red house"
>
> PB> or
>
> PB> curl --proxy clprox:80 --url http://www.google.fr -F "Recherche
> PB> Google"="red house"
>
> PB> could you give me a curl syntax which runs correctly for this
> exemple
>
>

-->
> curl --proxy clprox:80 --url http://www.google.fr/search \
> --data-ascii hl=fr \
> --data-ascii q=red+house \
> --data-ascii btnG=Recherche+Google \
> --data-ascii meta=
>

hi , and thanks for your help

however, the given curl syntax doesn t return the good page ( an error
page in fact)
may be google protect

so if i take the yellow page url as exemple which seems to have some
more results

when entering the url, in the main page ,we have to enter by example the
name, and the departement, and validate by clicking on a 'search '
button

an extract of the html page is at the end of the mail

i have well understood the data or form options to set input values.
i tryed several syntax with curl: one of them is the following one

curl --proxy clprox:80 --url http://www.pagesjaunes.fr/pj.cgi? -F
FRM_NOM=baudry -F FRM_DEPARTEMENT=92 -F JF_INSCRIPTIONS_REQ=submit
>/export/home1/om71/Java/res.html

when i display the res.html, it is the same welcome page with the input
boxes filled with name and dept, but not a research result page, as if
the emulation of the click on search button doesnt work

for my understanding og the html page, the search button has
JF_INSCRIPTIONS_REQ for name

====>>> WHAT is the curl syntax to emulate the search buton click
activate. (and finaly how to build a complete curl syntax which runs in
that case)

i dont find detailed explications on how to proceed in the curl
documentation about Form and data options. A complete exemple should be
the welcome. data input emulation on html pages is an important
functionnality for us

thanks

=============================
<tr>
<td><label for="frm_nom">&nbsp;&nbsp;</label></td>
<td background="files/images/onglet_fond.gif" align="left" valign="top">
<img src="files/images/cale.gif" height="1" width="2" alt="">
<input tabindex="2" class="txtchamps_home" name="FRM_NOM" id="qui"
size="30" value="" onFocus="window.status='TAPEZ LE NOM D\'UN
PROFESSIONNEL';return true">
</td>
<td>&nbsp;</td>
</tr>
...

<td align="right" nowrap="nowrap">&nbsp;</td>
<td align="left" background="files/images/onglet_fond.gif"
nowrap="nowrap">
<img src="files/images/cale.gif" height="1" width="2" alt="">
<input tabindex="5" class="txtchamps_home" name="FRM_DEPARTEMENT"
id="departement" size="30" value="" onFocus="window.status='TAPEZ LE NOM
OU LE NUMERO D\'UN
DEPARTEMENT, OU LE NOM D\'UNE REGION';return true">
<a href="javascript:AppelGuide('JF_GUIDE_GEO_REG_TEXT',document.form)"
class="txt_guide">Guide</a>
</td>
<td></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">&nbsp;</td>
<td class="qui" height="11" align="left" valign="top">
<img src="files/images/onglet_ba.gif" align="texttop" border="0"
height="11" width="6" alt="">
&nbsp;<label for="departement"><strong>D\351partement ou
r\351gion</strong> (ex: 92, idf)</label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3" height="10"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center">
<input tabindex="6" name="JF_INSCRIPTIONS_REQ"
src="files/images/rechercher_new.gif" border=0 alt="Lancer la recherche"
type="image">
</td>
<td>&nbsp;</td>
</tr>
</table>

-- 
Philippe Baudry
Received on 2007-02-15