BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NMHTTP and POST

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Web)
View previous topic :: View next topic  
Author Message
Eduardo Jauch
Guest





PostPosted: Tue Feb 06, 2007 7:58 am    Post subject: NMHTTP and POST Reply with quote



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!
Back to top
Hans Galema
Guest





PostPosted: Tue Feb 06, 2007 4:50 pm    Post subject: Re: NMHTTP and POST Reply with quote



Eduardo Jauch wrote:

Quote:
I'm trying now to post information using NMHTTP

Why are you not using TIdHTTP from Indy? TNMHTTP from Netmasters
are depricated.

Quote:
function addLocale()
{
var frm = document.forms[0];

Are you shure that the used <form> is the first one?

Quote:
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.

Quote:
form name="loginForm" method="get" action="/agendamento-web/login"


Quote:
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!

Quote:
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.
Back to top
Eduardo Jauch
Guest





PostPosted: Tue Feb 06, 2007 9:57 pm    Post subject: Re: NMHTTP and POST Reply with quote



Hans Galema escreveu:
Quote:
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?

Quote:
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...

Quote:
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...

Quote:
&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! Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Web) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.