Re: URLEncode problem

Giganews Newsgroups
Subject: Re: URLEncode problem
Posted by:  Brian (n…@given.com)
Date: Sun, 5 Jun 2005

Hi Gambit

The below code was writting uasing the Indy
that came with Delphi 6 pro, i have looked at
the help file and all it saids is

AURLString := TIdURI.URLEncode(AString);

It doesn't say anything about the below unsing <protocol>

code is ment to send some info via http to a PHP emailer
script (long reson why its done this way)

    aStream := TMemoryStream.create;
    Params := TStringStream.create('');

    T2SLiveMain.IdHTTP1.Request.ContentType :=
'application/x-www-form-urlencoded';

    Params.WriteString(TIdURI.URLEncode('to='+sendto+'&'));
    if cc <> '' then Params.WriteString(TIdURI.URLEncode('cc='+cc+'&'));
    Params.WriteString(TIdURI.URLEncode('from='+from+'&'));
    Params.WriteString(TIdURI.URLEncode('body='+emailbody));

    try
      T2SLiveMain.IdHTTP1.Post(EmailerLocation, Params, aStream);
      aStream.WriteBuffer(#0' ', 1);
      aStream.Position := 0;
    except
      DoError('ERROR-31: Could not send report to emailer');
    end; // try

Brian

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:0D7F9BDA82CDE240no.spam@no.spam.com...
>
> "Brian" <n…@given.com> wrote in message
> news:E97B6FD07CCDE240n…@given.com...
>
>> I have recently upgraded to Indy 10, when I try to run the
>> TIdURI.URLEncode I get an error saying protocol not set,
>> why?
>
> What string value are you passing in to begin with?  It must begin with
> "<protocol>://" where "<protocol>" is something like "http", "ftp", etc.
>
> Gambit

Replies

In response to

Re: URLEncode problem posted by Remy Lebeau (TeamB) on Sun, 5 Jun 2005