The simple module for making requests to websites
Author: tankalxat34
- Download this file or click to "DOWNLOAD" button.
- Open your Microsoft Excel Book and in window
"Project - VBAProject"
click on free place and than "Import file". - Choice the downloaded file.
- Enjoy.
Parameter | Type | Description |
---|---|---|
sURL | String | The string URL of web-site |
headersDictionary | Object Scripting.Dictionary | A dictionary containing headers for making a successful request to a website. You can set the headers yourself, or use the "createHeaders" function to automatically apply default headers to your request |
username | String | String containing your username for login in website |
password | String | String containing your password or token for login in website |
typeRequest | String | String of type for request: "GET", "POST", "PUT" and other types |
This code will show you your IP address
Sub helloworld()
Dim userIP As String
userIP = vbaRequests.request("https://ifconfig.me/ip")
MsgBox userIP
End Sub
Sub githubResponse()
Debug.Print vbaRequests.request("https://api.github.com/users/tankalxat34", _
vbaRequests.createHeaders(), _
"tankalxat34", "YOUR_TOKEN", _
"GET")
End Sub
Response from WGMods.net
Code:
Sub get_response()
Dim headers As Object
Set headers = CreateObject("Scripting.Dictionary")
headers.Add "x-csrftoken", "NG97PVrI2orqk2UvBXyFB9GpHCNGHHFbbrRJogqbwFCEgTNoLsD383orPnQrq4wb"
headers.Add "x-requested-with", "XMLHttpRequest"
Debug.Print vbaRequests.request("https://wgmods.net/api/mods/2548/", vbaRequests.createHeaders(headers))
End Sub