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
QHarr
  • 83,427
  • 12
  • 54
  • 101
Tahor Sui Juris
  • 131
  • 1
  • 12

1 Answers1

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"
QHarr
  • 83,427
  • 12
  • 54
  • 101
  • 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]https://i.imgur.com/GPElqc6.png – Tahor Sui Juris Jan 30 '19 at 18:47
  • Remove that and use the .responseText direct without the strconv – QHarr Jan 30 '19 at 18:49
  • 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: 'http://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"' – Tahor Sui Juris Jan 30 '19 at 19:37
  • 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. – Tahor Sui Juris Jan 30 '19 at 20:11
  • Not sure whether using the following url and examing the response would do the trick: "http://www.whatismyproxy.com/" – QHarr Jan 30 '19 at 20:40
  • And no, you shouldn't accept if you are not satisfied or the problem is not properly resolved. – QHarr Jan 30 '19 at 20:43
  • thank you the balance of the issue is with the proxy provider. The end solution of the above worked, thank you. – Tahor Sui Juris Jan 30 '19 at 21:25
  • end solution being? :-) – QHarr Jan 30 '19 at 21:44
  • 1
    just now saw your message. `'XMLHTTP.setProxy 2, "http=url or IP:port" 'XMLHTTP.setProxyCredentials "username", "password"` – Tahor Sui Juris Feb 11 '19 at 01:24