Article View: borland.public.cppbuilder.internet.web
Article #872Re: vbscript
From: Remy Lebeau (TeamB)
Date: Wed, 25 Jan 2006 19:14
Date: Wed, 25 Jan 2006 19:14
52 lines
2553 bytes
2553 bytes
"anton" <acvoosten@zeelandnet.nl> wrote in message
news:43d759c1$1@newsgroups.borland.com...
> I discovered a piece of vbscript to turn on and off an
> adslmodem. Has someone an idea to translate this script to bcb?
A literal translation would be as follows:
void __fastcall download(const AnsiString &DataToSend)
{
Variant objXML = Variant::CreateObject("Microsoft.XMLHTTP");
objXML.OleProcedure("Open", "POST", "http://10.0.0.138/cgi/dial/",
false);
objXML.OleProcedure("setRequestHeader", "Content-Type",
"application/x-www-form-urlencoded");
objXML.OleProcedure("Send", DataToSend);
}
With that said, the above requires MSXML to be installed. I would suggest
using an actual HTTP component instead, such as the one from Indy
(http://indyproject.org), ICS (http://www.overbyte.be), or Synapse
(http://www.ararat.cz/synapse). Then you won't have any external
dependancies.
For example, in Indy:
void __fastcall Download(const AnsiString &DataToSend)
{
TIdHTTP *HTTP = new TIdHTTP(NULL);
try
{
TStringStream *Data = new TStringStream(Data);
try
{
HTTP->Request->ContentType =
"application/x-www-form-urlencoded";
HTTP->Post("http://10.0.0.138/cgi/dial/", Data);
}
__finally
{
delete Data;
}
}
__finally
{
delete HTTP;
}
}
Gambit
Technical Details
Message-ID:
<43d7cd6e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43d759c1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,f766eaff99f31577 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: <43d759c1$1@newsgroups.borland.com> Subject: Re: vbscript Date: Wed, 25 Jan 2006 11:14:27 -0800 Lines: 54 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: <43d7cd6e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1138216302 68.69.17.41 (25 Jan 2006 11:11:42 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail