Hi guys, As you know, i´m having some problems to make this thing work. I have to write a script that automatically sends a code and get the some information according to that code. I mean, this script has to automatically fill in a formfield and get the result. But I just can´t get it done. If you´re really really in the mood for helping me, I´m posting down here the source code of the page of the form that the script must fill in and get the result. The url is: http://www.tj.go.gov.br/online/Inicial/Processos/ConsultaProc_1Grau_Capital.dml And here is the URL for the page that returns the result: http://www.tj.go.gov.br/online/Capital/Processos_SPG/Resp_Processo1.dml After this source code, you´ll see the code of my script, please, help me!
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Consulta Processos da Capital</title> <script> function MM_findObj(n, d) { //v3.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; } function MM_changeProp(objName,x,theProp,theValue) { var obj = MM_findObj(objName); if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'"); } MM_changeProp('principal?superior','','value','../../Tribunal/Processos/Consulta.dml','a'); var barranumero = "/images/consulta/abarra3.jpg"; MM_changeProp('barra?superior','','src',barranumero,'a'); function valida(proc) { if (proc.length<9) { alert('Processo deve ter mais de 9 caracteres.'); return(false); } if (isNaN(proc)) { alert('Processo deve ser numerico'); return(false); } return(true); } function valida_oab() { troca_maiusculo(1); return(true); } function valida_nome(nome) { troca_maiusculo(2); var car = nome.charAt(0); if ((car == "") || (car == " ")) { alert('Nome deve ser preenchido'); return(false); } if (nome.length<3) { alert('Nome deve ter no mínimo 3 caracteres.'); return(false); } var vet_nome = nome.split(" "); if ((vet_nome.length < 2) || (vet_nome[1] == '')) { alert('Pelo menos 2 nomes devem ser preenchidos'); return(false); } return(true); } function troca_maiusculo(tipo) { if (tipo == 1) { var oab = new String(document.form12.numroab.value); document.form12.numroab.value = oab.toUpperCase(); } if (tipo == 2) { var nome = new String(document.form13.nomepessoa.value); document.form13.nomepessoa.value = nome.toUpperCase(); } return; } // --> </script> </head> <body style="background-image: url(/imagens/fundobandeira.jpg); background-repeat: no-repeat" leftmargin="0"> <div align="center"> <table border="0" width="95%" cellspacing="0" cellpadding="1"> <! =========== 1 GRAU ============== > <tr> <td width="100%" align="left"> <font face="verdana,tahoma,arial,helvetica" size="2" color="#313073"><b>Processos de 1º Grau - Processos da Capital</b></font> </td> </tr> <tr> <td width="100%" align="left"> <form METHOD="GET" ACTION="../../Capital/Processos_SPG/Resp_Processo1.dml" NAME="form1" ONSUBMIT="return valida(document.form1.numrproc.value);"> <table width="100%"> <tr><br></tr> <tr> <td width="20%"><font face="verdana,tahoma,arial,helvetica" size="1" color="#313073"> Processo:</font></td> <td width="80%"><!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="12" --><INPUT SIZE="14" MAXLENGTH="12" TYPE="text" NAME="numrproc" > <INPUT TYPE="submit" VALUE="Consultar" NAME="B1" ></td> </tr> </table> <INPUT TYPE="HIDDEN" VALUE="SPG2301N" NAME="nrot" ><INPUT TYPE="HIDDEN" VALUE="P1" NAME="flag" ><INPUT TYPE="HIDDEN" VALUE="0000" NAME="numrinter" ><INPUT VALUE TYPE="HIDDEN" NAME="mensagem" > </form> </td> </tr> <tr> <td width="100%" align="left"> <form METHOD="GET" ACTION="../../Capital/Processos_SPG/Resp_Sel_Proc.dml" NAME="form12" ONSUBMIT="return valida_oab(document.form12.numroab.value);"> <table width="100%"> <tr> <td width="20%"><font face="verdana,tahoma,arial,helvetica" size="1" color="#313073"> Oab Advogado:</font></td> <td width="80%"><!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="7" --><INPUT SIZE="7" ONCHANGE="troca_maiusculo(1)" MAXLENGTH="7" TYPE="text" NAME="numroab" > <select name="siglaoab" size="1"> <option value="AC">AC</option> <option value="AL">AL</option> <option value="AM">AM</option> <option value="AP">AP</option> <option value="BA">BA</option> <option value="CE">CE</option> <option value="DF">DF</option> <option value="ES">ES</option> <option selected value="GO">GO</option> <option value="MA">MA</option> <option value="MG">MG</option> <option value="MS">MS</option> <option value="MT">MT</option> <option value="PA">PA</option> <option value="PB">PB</option> <option value="PE">PE</option> <option value="PI">PI</option> <option value="PR">PR</option> <option value="RJ">RJ</option> <option value="RN">RN</option> <option value="RO">RO</option> <option value="RR">RR</option> <option value="RS">RS</option> <option value="SC">SC</option> <option value="SE">SE</option> <option value="SP">SP</option> <option value="TO">TO</option> </select> <INPUT TYPE="submit" VALUE="Consultar" NAME="B1" ></td> </tr> </table> <INPUT TYPE="HIDDEN" VALUE="SPG2332N" NAME="nrot" ><INPUT TYPE="HIDDEN" VALUE="P1" NAME="flag" ><INPUT VALUE TYPE="HIDDEN" NAME="mensagem" ><INPUT TYPE="HIDDEN" VALUE="00000000" NAME="isnpessoa" ><INPUT TYPE="HIDDEN" VALUE="000000" NAME="serventia" ><INPUT VALUE TYPE="HIDDEN" NAME="datainicial" ><INPUT VALUE TYPE="HIDDEN" NAME="datafinal" ><INPUT TYPE="HIDDEN" VALUE="0" NAME="tipoarea" ><INPUT TYPE="HIDDEN" VALUE="000000000000" NAME="ultproc" ><INPUT TYPE="HIDDEN" VALUE="00000000" NAME="ultisn" ><INPUT TYPE="HIDDEN" VALUE="1" NAME="opcao" > </form> </td> </tr> <tr> <td width="100%" align="left"> <form METHOD="GET" ACTION="../../Capital/Processos_SPG/Resp_Sel_Nome.dml" NAME="form13" ONSUBMIT="return valida_nome(document.form13.nomepessoa.value);"> <table width="100%"> <tr> <td width="20%"><font face="verdana,tahoma,arial,helvetica" size="1" color="#313073"> Nome Parte:</font></td> <td width="80%"><!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="80" --><INPUT SIZE="40" ONCHANGE="troca_maiusculo(2)" MAXLENGTH="80" TYPE="text" NAME="nomepessoa" > <INPUT TYPE="submit" VALUE="Consultar" NAME="B1" ></td> </tr> <tr> <td width="20%"><font face="verdana,tahoma,arial,helvetica" size="1" color="#313073"> </font></td> <td width="80%"><i><font face="verdana,tahoma,arial,helvetica" size="0.5" color="red"> --Não utilize acentos no Nome da Parte--</font></i></td> </tr> </table> <INPUT TYPE="HIDDEN" VALUE="SPG2331N" NAME="nrot" ><INPUT TYPE="HIDDEN" VALUE="P1" NAME="flag" ><INPUT VALUE TYPE="HIDDEN" NAME="mensagem" ><INPUT TYPE="HIDDEN" VALUE="00000000000000" NAME="numrcpfcgc" ><INPUT VALUE TYPE="HIDDEN" NAME="nomeprofissao" ><INPUT VALUE TYPE="HIDDEN" NAME="numridentidade" ><INPUT VALUE TYPE="HIDDEN" NAME="siglufident" ><INPUT VALUE TYPE="HIDDEN" NAME="nomepai" ><INPUT VALUE TYPE="HIDDEN" NAME="nomemae" ><INPUT TYPE="HIDDEN" VALUE="1" NAME="opcao" ><INPUT TYPE="HIDDEN" VALUE="00000000" NAME="ultisn" > </form> </td> </tr> </table> <p align="center"><font face="verdana,tahoma,arial,helvetica" size="1" color="#303173">A Consulta de Processos está disponível de<br> SEG-SEX das 8:00 às 22:00 h <br> Copyright 2004. Todos os direitos reservados. <br> </font> <! <img SRC="http://webmail.tj.go.gov.br/cgi-bin/Count.cgi?trgb=ffffff&dd=E" ALT="Nº de acessos!"><br> </p> </div> <script> document.form1.numrproc.focus(); </script> </body> </html> PERL Script #!/usr/bin/perl use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 "); $ua->cookie_jar({}); my $req = HTTP::Request->new(POST => 'http://www.tj.go.gov.br/online/Capital/Processos_SPG/Resp_Processo1.dml'); #my $req = HTTP::Request->new(POST => 'http://www.tj.go.gov.br/online/Inicial/Processos/ConsultaProc_1Grau_Capital.dml'); $req->content_type('application/x-www-form-urlencoded'); $req->content('numrproc=009600352534'); #&mode=dist'); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>