🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Indy version, Post method

#802
From: Remy Lebeau (TeamB)
Date: Tue, 31 Jan 2006 23:55
67 lines
3381 bytes
"Denville Longhurst" <Denville@metco.co.uk> wrote in message
news:43dff36a@newsgroups.borland.com...

> OK, here is a simple, working form that illustrates what I
> want to achieve from a BCB application using Indy
> (TIdHTTP v 8.0.25)

That is a VERY VERY old version of Indy.  Indy 8 is no longer supported by
Indy's developers (including me).  You should upgrade to at least the latest
Indy 9.0.50 snapshot.

Under Indy 9 (and 10), the code would be one of the following, depending on
whether the script expects data to be posted using the "multipart/form-data"
encoding or not:

1)

    TStringList *Values = new TStringList;
    try
    {
        Values->Add("recipient=fpl@metco.co.uk");
        Values->Add("env_report=REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT");
        Values->Add("print_config=email,realname,subject");
        Values->Add("sort=order:message");
        Values->Add("print_blank_fields=1");

Values->Add("redirect=http://www.metco.co.uk/MyTemp/FplWeback1.htm");
        Values->Add("email=a.pilot@metco.co.uk");
        Values->Add("MyName=Denville");
        Values->Add("MyTown=Leeds, England");
        Values->Add("Submit=Submit");
        Memo1->Text =
IdHTTP1->Post("http://cgi.uk2.net/cgi-bin/uk2-formmail.pl", Values);
    }
    __finally {
        deleteValues;
    }

2)

    #include "IdMultipartFormData.hpp"

    TIdMultipartFormDataStream *Values = new TIdMultipartFormDataStream;
    try
    {
        Values->AddFormField("recipient", "fpl@metco.co.uk");
        Values->AddFormField("env_report",
"REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT");
        Values->AddFormField("print_config", "email,realname,subject");
        Values->AddFormField("sort", "order:message");
        Values->AddFormField("print_blank_fields", "1");
        Values->AddFormField("redirect",
"http://www.metco.co.uk/MyTemp/FplWeback1.htm");
        Values->AddFormField("email", "a.pilot@metco.co.uk");
        Values->AddFormField("MyName", "Denville");
        Values->AddFormField("MyTown", "Leeds, England");
        Values->AddFormField("Submit", "Submit");
        Memo1->Text =
IdHTTP1->Post("http://cgi.uk2.net/cgi-bin/uk2-formmail.pl", Values);
    }
    __finally {
        deleteValues;
    }


Gambit
Technical Details
Message-ID: <43dff852$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43df9c82@newsgroups.borland.com> <43dfa6dd$5@newsgroups.borland.com> <43dff36a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,e22aba21c3053d6a
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <43df9c82@newsgroups.borland.com> <43dfa6dd$5@newsgroups.borland.com> <43dff36a@newsgroups.borland.com>
Subject: Re: Indy version, Post method
Date: Tue, 31 Jan 2006 15:55:16 -0800
Lines: 69
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <43dff852$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1138751570 68.69.17.41 (31 Jan 2006 15:52:50 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail