Jump to content

Microsoft.XMLHTTP setproxy problem


beginner10
 Share

Recommended Posts

Hi,

Does anyone know how I can set the correct proxy in this script?

 

Thank you

Func _MicrosoftXMLHTTP($url)
    $oHttp = ObjCreate("Microsoft.XMLHTTP")

    ;$oHttp.setProxy(2, "209.127.191.111:9279")
    ;$oHttp.setProxyCredentials("user", "pass")


    $oHttp.Open("GET", $url, 0)


    $oHttp.Send()
    If @error Then Return SetError(1, 0, 0)
    $sReceived = $oHttp.ResponseText
    Return $sReceived
EndFunc   ;==>_MicrosoftXMLHTTP
Edited by beginner10
Link to comment
Share on other sites

Use WinHttpRequest:

$o_http = ObjCreate("winhttp.winhttprequest.5.1")
If $ini_proxy <> '' Then
    $o_http.SetProxy($HTTPREQUEST_PROXYSETTING_PROXY, $ini_proxy, "") ; 209.127.191.111:9279
    If $ini_proxy_name <> '' Then $o_http.SetCredentials($ini_proxy_name, $ini_proxy_pwd, $HTTPREQUEST_SETCREDENTIALS_FOR_PROXY)
EndIf
$o_HTTP.Open('GET', $url, False)
$o_HTTP.Send()
;If $o_HTTP.Status <> '200' Then ...
$ret = $o_HTTP.Responsetext

 

Global Const $HTTPREQUEST_PROXYSETTING_DEFAULT = 0
Global Const $HTTPREQUEST_PROXYSETTING_PRECONFIG = 0
Global Const $HTTPREQUEST_PROXYSETTING_DIRECT = 1
Global Const $HTTPREQUEST_PROXYSETTING_PROXY = 2
Global Const $HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Global Const $HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1

 

Edited by Zedna
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...