1

I get sent a lot of e-mails, and I need to create an account on a Spigit (https://www.spigit.com/) page my company owns for everyone who sent me an e-mail.

This is a tedious process and takes a few minutes for every user. To automate this, I created an outlook VBA script that parses the names of the senders and their respective e-mail adresses for the sign-up form on spigit into an excel table.
Did some googling on how to process further, I had some "javascript reads excel table and fills in form" in mind. A solution was to use a http post request instead, as the form is barely the user-machine interface.

So I looked into the task to create a http post request with given data.

Sub testhttp()
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    URL = "https://company.spigit.com/main/Admin/UsersAction?action=create_user"
    objHTTP.Open "POST", URL, False
    objHTTP.SetRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64)"
    objHTTP.SetRequestHeader "Content-type", "application/x-www-form-urlencoded; charset=UTF-8"
    objHTTP.SetRequestHeader "Host", "company.spigit.com"
    objHTTP.SetRequestHeader "Referer", "https://company.spigit.com/main/Admin/Dashboard?orig_url=/Page/UserAdmin"
    objHTTP.Send ("form_id=randomstring123&username=testuser123&pw=pw123&pw2=pw123&firstname=Max&lastname=Mustermann&email=maurice@company.com")
End Sub

Thank you thiscode for the code snippet

The request form_id=randomstring... will be adjusted later to iterate through the excel data.

The problem is, that on execution in Excel VBA, it says

The server name or address could not be resolved.

As this is the first time I try httprequests, I'd like to ask you bunch if you have any ideas.

Thanks in advance, Maurice

EDIT#1on180524: How to fill a form with post request and get response as stated in the reply by jonathanl, it works different if the site requires cookies (it does!) and some javascript to be done on the form (I think it does? It certainly checks, whether or not your input is valid.) With these boundaries I'll probably search for an easier approach, as using third party tools is quite a challenge in a company enviroment.

Maurice
  • 31
  • 1
  • 5

0 Answers0