I'm trying to run the following cURL request (as provided by Maxmind) within VBA:
curl -u "{user_id}:{license_key}" \
"https://geoip.maxmind.com/geoip/v2.1/city/me?pretty"
Taking from other examples I've tried the following:
Sub maxmind_query()
Dim TargetURL As String
Dim HTTPReq As Object
TargetURL = "https://geoip.maxmind.com/geoip/v2.1/city/me"
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTPReq.Option(4) = 13056 '
HTTPReq.Open "PUT", TargetURL, False
HTTPReq.SetCredentials "XXXXX", "YYYYYYYY", 0
HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HTTPReq.send ("test[status]=" & Forms!curl!Text0.Value & "&test2[status]=" & Text2.Value)
MsgBox (HTTPReq.responseText)
End Sub
'''XXXX is my user id, YYYY my license key, removed for obvious reasons!
This errors at HTTPReq.send (runtime error 424 object required) which has me stumped.
I have no knowledge of cURL so despite a few days of research and blind attempts, I'm struggling to get anywhere with the above code.
I'm only experienced with VBA, and what I know is self taught, so be gentle....
If anyone is able to share their knowledge I'd be much obliged.
Further info provided by Maxmind:
http://dev.maxmind.com/geoip/geoip2/web-services/#Per-Service_URIs http://dev.maxmind.com/geoip/geoip2/web-services/#Command_Line_curl_Example
Many thanks!
PS. If I put the URL in a browser, input username and password into message box, the browser returns the required information, so I know the service and my credentials work. I guess my code isn't even getting that far though.