Thread View: borland.public.cppbuilder.internet.web
3 messages
3 total messages
Started by anton
Wed, 25 Jan 2006 11:01
vbscript
Author: anton
Date: Wed, 25 Jan 2006 11:01
Date: Wed, 25 Jan 2006 11:01
16 lines
1210 bytes
1210 bytes
Hello
I discovered a piece of vbscript to turn on and off an adslmodem.
Has someone an idea to translate this script to bcb?
Thanks a lot
Anton
sub download(DataToSend)
set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", "http://10.0.0.138/cgi/dial/", false
objXML.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
objXML.Send DataToSend
end sub
Re: vbscript
Author: 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
Re: vbscript
Author: anton
Date: Thu, 26 Jan 2006 13:38
Date: Thu, 26 Jan 2006 13:38
62 lines
2792 bytes
2792 bytes
That's a lot of helpful imformation.
Thank you very much
Anton
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schreef in bericht
news:43d7cd6e@newsgroups.borland.com...
>
> "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
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads