title: Sending HTTP-Post Request to fill in form in VBA
body: <p>I get sent a lot of e-mails, and I need to create an account on a Spigit (<a href="https://www.spigit.com/" rel="nofollow noreferrer">https://www.spigit.com/</a>) page my company owns for everyone who sent me an e-mail.</p>
  
  <p>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.<br>
  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.</p>
  
  <p>So I looked into the task to create a http post request with given data.</p>
  
  <pre><code>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&amp;username=testuser123&amp;pw=pw123&amp;pw2=pw123&amp;firstname=Max&amp;lastname=Mustermann&amp;email=maurice@company.com")
  End Sub
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/158633/how-can-i-send-an-http-post-request-to-a-server-from-excel-using-vba">Thank you thiscode for the code snippet</a></p>
  
  <p>The request <code>form_id=randomstring...</code> will be adjusted later to iterate through the excel data.</p>
  
  <p>The problem is, that on execution in Excel VBA, it says</p>
  
  <blockquote>
    <p>The server name or address could not be resolved.</p>
  </blockquote>
  
  <p>As this is the first time I try httprequests, I'd like to ask you bunch if you have any ideas.</p>
  
  <p>Thanks in advance,
  Maurice</p>
  
  <p>EDIT#1on180524: 
  <a href="https://stackoverflow.com/questions/48199019/how-to-fill-a-form-with-post-request-and-get-response">How to fill a form with post request and get response</a> 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.</p>