title: Send SMS through Twilio HTTP POST with VBScript
body: <p>I'm trying to send an SMS using Twilio. I found an article (<a href="https://www.twilio.com/blog/2010/04/using-twilio-with-classic-asp-and-vbscript.html" rel="nofollow noreferrer">https://www.twilio.com/blog/2010/04/using-twilio-with-classic-asp-and-vbscript.html</a>) that shows how to do this by VBScript, but I was wondering how to amend the script when sending a POST request from a client computer and not a server.</p>
  
  <p>I tried to give this a first pass, but I'm not too familiar with VBScript. I found some articles saying to use the System.Web.HttpUtility to run URLEncode()</p>
  
  <p>Any help would be much appreciated. </p>
  
  <pre><code>accountSid = "XXXX"
  authToken = "XXXX"
  
  baseUrl = "https://api.twilio.com"
  smsUrl = baseUrl &amp; "/2010-04-01/Accounts/" &amp; accountSid &amp; "/SMS/Messages"
  ' setup the request and authorization
  Set http = CreateObject("MSXML2.XMLHTTP.6.0")
  http.open "POST", smsUrl, False, accountSid, authToken
  http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  
  ' message parameters
  from = "XXX" ' the number to send the message from
  recipient = "XXX" ' the number to send the message to
  body = "Sending SMS is easy with Twilio!" ' message contents
  
  
  Set sendbot=CreateObject(System.Web.HttpUtility)
  postData = "From=" &amp; sendbot.URLEncode(from)
  postData = postData &amp; "&amp;To=" &amp; sendbot.URLEncode(recipient)
  postData = postData &amp; "&amp;Body=" &amp;  sendbot.URLEncode(body) 
  ' send the POST data
  http.send postData
  ' optionally write out the response if you need to check if it worked
  ' Response.Write http.responseText
  ' clean up
  Set http = Nothing
  </code></pre>