I'm trying to get a page from riolistas.com.br.

1) submit the form to start the session
2) request the real data (GET with parameters Pag=0&Off=2)

The problem is that the second request must be done in the same browser session.

Is there any way to keep the session open until i make the second request ?







#!/usr/bin/perl

require HTML::Form;
require LWP::UserAgent;

my $resp = HTTP::Response->new("200", "OK" );

$conteudo = '
  <body>
  <form method=POST action="http://www.riolistas.com.br/scripts/actbuscresd.asp";>
  <input type="text" size=10 maxlength=10 name="cboCidade" value="05000">
  <input type="text" size=10 maxlength=10 name="cboCidadeFiltro" value="05000">
  <input type="text" size=10 maxlength=10 name="cboBairro" value="00066">
  <input type="text" size=10 maxlength=10 name="cboBairro_Real" value="00066">
  <input type="text" size=10 maxlength=10 name="cboZona" value="">
  <input type="text" size=10 maxlength=10 name="cboZona_Real" value="">
  <input type="text" size=10 maxlength=10 name="optFormBusc" value="P">
  <input type="text" size=10 maxlength=10 name="txtPessoa" value="a">
  <input type="text" size=10 maxlength=10 name="txtEndereco" value="">
  <input type="text" size=10 maxlength=10 name="txtnumero" value="">
  <input type="text" size=10 maxlength=30 name="estado" value="telelistas_com.asp">
  <input type="text" size=10 maxlength=10 name="action" value="Ache">
  <input type="submit" name="Submit" value="OK">
  </form>
  </body>
';

$resp->content( $conteudo );

my $form1 = HTML::Form->parse( $resp->content, "http://www.riolistas.com.br/scripts/";);

$a1 = LWP::UserAgent->new->request($form1->click);  

$form1->action("http://www.riolistas.com.br/scripts/actbuscresd.asp?Pag=0&Off=2";);  

$a2 = LWP::UserAgent->new->request($form1->click);  

print $a1->as_string;
print "<HR>\n";
print $a2->as_string;

Reply via email to