Jump to content
Sign in to follow this  

$oHTTP.Open load value from txt file

Recommended Posts



is it possible to load value of variable from url .txt file ?

file contain like

$server1 = server1.1234.com

$server2 = server2.1234.com

Func _LoadVarHTTP($URLtoLoad)
    Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
    Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    If @error Then Return
    $oHTTP.Open("GET", $URLtoLoad, False)
    If @error Then Return
    If @error Then Return
    ConsoleWrite($oHTTP.Status & @CRLF)
    If $oHTTP.Status <> $HTTP_STATUS_OK Then Return
    Local $oHTTPSource = $oHTTP.Responsetext
    Local $oHTTPFileOpen = FileOpen(@ScriptDir & '\' & test.txt 2)
    FileWrite($oHTTPFileOpen, $oHTTPSource)
EndFunc   ;==>_LoadVarHTTP

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.