🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #245

Re: NMHTTP and POST

#245
From: Hans Galema
Date: Tue, 06 Feb 2007 10:50
55 lines
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.
Technical Details
Message-ID: <45c85e29$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45c7dcdf@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,192a554a5062421b
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 06 Feb 2007 11:50:26 +0100
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.web
Subject: Re: NMHTTP and POST
References: <45c7dcdf@newsgroups.borland.com>
In-Reply-To: <45c7dcdf@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 145.98.201.248
Message-ID: <45c85e29$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170759209 145.98.201.248 (6 Feb 2007 02:53:29 -0800)
Lines: 55
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail