Jump to content

My "http wrapper"


AzKay
 Share

Recommended Posts

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- #
Link to comment
Share on other sites

^ 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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...