Thread View: borland.public.cppbuilder.internet.web
3 messages
3 total messages
Started by Eduardo Jauch
Tue, 06 Feb 2007 01:58
NMHTTP and POST
Author: 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!
Re: NMHTTP and POST
Author: Hans Galema
Date: Tue, 06 Feb 2007 10:50
Date: Tue, 06 Feb 2007 10:50
55 lines
2443 bytes
2443 bytes
Eduardo Jauch wrote:
> I'm trying now to post information using NMHTTP
Why are you not using TIdHTTP from Indy? TNMHTTP from Netmasters
are depricated.
> function addLocale()
> {
> var frm = document.forms[0];
Are you shure that the used <form> is the first one?
> 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";
Hmmm. Did not know that it was possible to change a 'method' from
get to post.
> <form name="loginForm" method="get" action="/agendamento-web/login">
> 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";
> NMHTTP1->Post("/agendamento-web/login", post_data); //FAIL. Call OnFail
> //ERROR. Causes a error.
Please tell exactly which error!
> Is the post data correct "writen" in the string?
> Am I forgeting to do something?
I do not understand the part "&item=loginForm". As far as I can see
item has no value. I would think it should be empty: "&item=". Or
did't you tell the whole story?
&tipo=AGENCIA+DE+VIAGEM
What made you decide to replace ' ' by '+' ?
Hans.
Re: NMHTTP and POST
Author: Eduardo Jauch
Date: Tue, 06 Feb 2007 15:57
Date: Tue, 06 Feb 2007 15:57
51 lines
2591 bytes
2591 bytes
Hans Galema escreveu:
>> function enviar()
>> {
>> var frm = document.forms[0];
>> frm.action = "/agendamento-web/login";
>> frm.task.value = 'login';
>> frm.method = "POST";
>
> Hmmm. Did not know that it was possible to change a 'method' from
> get to post.
>
I'm too... I need more search on the subject for shure... Do you know
any good newsgroup or forum about Java script?
>> <form name="loginForm" method="get" action="/agendamento-web/login">
>
>
>> 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";
>
>> NMHTTP1->Post("/agendamento-web/login", post_data); //FAIL. Call OnFail
>> //ERROR. Causes a error.
>
> Please tell exactly which error!
>
Is an exception, like if the url are incorrect (And I think that is
exactly this case...
>> Is the post data correct "writen" in the string?
>> Am I forgeting to do something?
>
> I do not understand the part "&item=loginForm". As far as I can see
> item has no value. I would think it should be empty: "&item=". Or
> did't you tell the whole story?
>
You are correct... I try your way, but no success...
> &tipo=AGENCIA+DE+VIAGEM
>
> What made you decide to replace ' ' by '+' ?
>
Was not the case? No need to do this?
I saw some sites that used this way to post a form those words have
spaces ...
Thanks! :)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads