Article View: borland.public.cppbuilder.internet.web
Article #433NMHTTP and POST
From: Eduardo Jauch
Date: Tue, 06 Feb 2007 01:58
Date: Tue, 06 Feb 2007 01:58
65 lines
2696 bytes
2696 bytes
Hello!
I'm trying now to post information using NMHTTP
I have this HTML Form:
function addLocale()
{
var frm = document.forms[0];
if(frm){
frm.innerHTML += '<input type="hidden" name="locale" value="pt_BR">';
frm.innerHTML += '<input type="hidden"
name="com.telecom.tipo_usuario" value="INTERNET">';
}
}
function enviar()
{
var frm = document.forms[0];
frm.action = "/agendamento-web/login";
frm.task.value = 'login';
frm.method = "POST";
frm.submit();
}
<form name="loginForm" method="get" action="/agendamento-web/login">
<input type="hidden" name="task" value="">
<input type="hidden" name="item" value="">
<input type="hidden" name="tipo" value="AGENCIA DE VIAGEM">
<input type="hidden" name="redirect" value="/agenciadores.do">
<input name="login" type="text" class="box_tabela" size="30">
<input name="senha" type="password" class="box_tabela" size="30">
<a href="javascript: enviar();">
I write this code:
//This OK, retrieves the body, header and cookies
NMHTTP1->Get("www.visto-eua.com.br/agendamento-web/login?redirect=/agenciadores.do");
AnsiString post_data =
"task=login&item=loginForm&tipo=AGENCIA+DE+VIAGEM&redirect=/agenciadores.do&login=MyLogin&senha=MyPassword&locale=pt_BR&com.telecom.tipo_usuario=INTERNET";
then, i tried this:
NMHTTP1->Post("www.visto-eua.com.br/agendamento-web/login?redirect=/agenciadores.do",
post_data); //SUCESS. Call OnSucess, but the body don't alter (the page
is the same, not what i retreive when I susseful login in the browser...
NMHTTP1->Post("www.visto-eua.com.br/agendamento-web/login", post_data);
//FAIL. Call OnFail
NMHTTP1->Post("/agendamento-web/login", post_data); //FAIL. Call OnFail
//ERROR. Causes a error.
Is the post data correct "writen" in the string?
Am I forgeting to do something?
Please, help me... :)
Thanks!
Technical Details
Message-ID:
<45c7dcdf@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: feeec,192a554a5062421b,start X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 05 Feb 2007 23:58:04 -0200 From: Eduardo Jauch <eduardo.jauch@gmail.com> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.web Subject: NMHTTP and POST Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 201.14.26.139 Message-ID: <45c7dcdf@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170726111 201.14.26.139 (5 Feb 2007 17:41:51 -0800) Lines: 65 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail