mIRC Home    About    Download    Register    News    Help

Print Thread
D
dylan
dylan
D
I'm trying to write a script that uses a HTTP proxy to post information on a https site and then read the information sent back, Is it possible? Maybe I need a DLL to do this?

Joined: Apr 2003
Posts: 413
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Apr 2003
Posts: 413
Yap.. That is possible.. You need ssl tunnel program like stunnel.. Check the examples of ussing on their site..
Also to see how your browser works with a proxy you can use a sniffer like Iris.. Often that will save you to read the boring RFC docs..

D
dylan
dylan
D
Okay, I'll try that. Thanks for your help

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
You can use a COM object called XMLHTTP for that. This script will request a page and return the HTTP response headers:
  • alias getpage {
    .comopen gp Microsoft.XMLHTTP
    !.echo -q $com(gp,Open,1,bstr,Get,bstr,$1,bool,false)
    !.echo -q $com(gp,Send,1)
    !.echo -q $com(gp,GetAllResponseHeaders,1)
    var %result = $com(gp).result
    .comclose gp
    return %result
    }
To test it, try: //echo -a $getpage(http://www.yahoo.com)

Edit: Keep in mind that due to mIRC limitations, you cannot use this object to retrieve a webpage body if it's longer than ~900 characters.

mIRC COM Tutorial
Article from 4GuysFromRolla
MSDN Object Reference

D
dylan
dylan
D
That's exactly what I was looking for. What about proxy support though? Do I have to script something else to get it to work with a proxy? Or does it use the proxy specified in Internet Explorer settings?

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
It uses IE's engine, so it follows its proxy settings too laugh

D
dylan
dylan
D
Fantastic, thanks a lot!

D
dylan
dylan
D
Oh, Also, What would I search for if I wanted more commands (Open, GetAllResponseHeaders, etc) so that maybe I could use this to display an entire webpage?

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Right after $com(gp,Send,1) you can call $com(gp,responseText,2) and $com(gp).result will hold the entire page contents.

For more methods and properties, see the MSDN reference laugh


Link Copied to Clipboard