Jump to content
Sign in to follow this  
AzKay

My "http wrapper"

Recommended Posts

AzKay

Just a helpful copypasta script that I made.

Might help others.

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
ConsoleWrite(_HTTPRequest($oHTTP, "GET", "http://google.com") & @CRLF)

Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "")
    $oHTTP.Open($oMethod, $oURL, False)
    If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    $oHTTP.Send($oData)
    Return $oHTTP.ResponseText
EndFunc

EDIT::

Typo'd. Thanks Manadar

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
jvanegmond

^ bugfixed.

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
ConsoleWrite(_HTTPRequest($oHTTP, "GET", "http://google.com") & @CRLF)

Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "")
    $oHTTP.Open($oMethod, $oURL, False)
    If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    $oHTTP.Send($oData)
    Return $oHTTP.ResponseText
EndFunc

Share this post


Link to post
Share on other sites
AzKay

Oh right. Thanks for that xD


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
subfighter

this look simliar to InGetSource... does do the same function and any advantages..

Share this post


Link to post
Share on other sites
jvanegmond

this look simliar to InGetSource... does do the same function and any advantages..

Wrong.

This allows you to set the header, and many other things if you know what you're doing. It's InetGetSource advanced. 8)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.