Tahor Sui Juris
Tahor Sui Juris

Reputation: 131

modify from XMLHTTP to ServerXMLHTTP for enabling proxy use

@Qharr How would one modify your wonderful script from XMLHTTP to ServerXMLHTTP for enabling proxy?

REF: Google search via VBA no results if use a phone number

Have reviewed this as without finding a solution: Differences between XMLHTTP and ServerXMLHTTP

    With CreateObject("MSXML2.XMLHTTP")
    .Open "GET", urlx, False
    '.setProxy 2, "proxy.net:8080"
    '.setProxyCredentials "proxy_login", "proxy_password"
    .send
    html.body.innerHTML = StrConv(.responseBody, vbUnicode)
End With

Upvotes: 1

Views: 8345

Answers (1)

QHarr
QHarr

Reputation: 84465

Try the following

.setProxy 2, "http=myProxyServer:8080", ""

This is using MSXML2.ServerXMLHTTP. Taken from here

Note the use of config

proxycfg -u

Also, see the link to proxycfg and how can I specify a proxy configuration using Microsoft.XMLHTTP?

If you decide to use a browser, see the following for using selenium and proxy.

Feedback from OP:

XMLHTTP.setProxy 2, "http=url or IP:port" 
XMLHTTP.setProxyCredentials "username", "password"

Upvotes: 1

Related Questions