1

@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

1 Answer 1

1

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"
Sign up to request clarification or add additional context in comments.

9 Comments

thank you. There is an issue with the following line of code which is not working with MSXML2.ServerXMLHTTP (by the way LOVE your script), please view the specific portion of your script in reference: [link]i.imgur.com/GPElqc6.png
Remove that and use the .responseText direct without the strconv
Excellent!, that resolved the run issue without adding the proxy configuration. Thank you. The remaining issue is the proxy line of code solution you shared with me above. Have reviewed the links you shared. How can I confirm the proxy is actually being applied? As your script runs but there is no indication that the proxy was actually used. Here is the line of code for the proxy: 'api.scraperapi.com?key=YOURAPIKEY&url=http://httpbin.org/ip' in relation to: 'XMLHTTP.setProxy 2, "http=myProxyServer:8080", ""' 'XMLHTTP.setProxyCredentials "proxy_login", "proxy_password"'
QHarr Should I mark the challenge resolved, as your script runs BUT I do not think it is actually using the proxy. here is the line of code that I am trying to function: curl "http://api.scraperapi.com?key=YOURAPIKEY&url=http://httpbin.org/ip" Any suggestions greatly appreciated, thank you.
just now saw your message. 'XMLHTTP.setProxy 2, "http=url or IP:port" 'XMLHTTP.setProxyCredentials "username", "password"
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.