im looking to use twilio sms services. i am integrating it into my database. to begin with i want the code behind a button on click event.
twilio help has given me some code that will work but the way it is set out i am strugling with to put in a private function
i am wanting to structure if any one can help.
im not sure if putting it in a private function is the correct way but until i know more about private, public etc i would prefer it to be this way. then at least i can edit it and make it what i want to move foreward.
also what will happen. i see 'RectangleArea(Height As Double, Width As Double) As Double'. will this open a rectangle box?
thanks
twilio help has given me some code that will work but the way it is set out i am strugling with to put in a private function
i am wanting to structure if any one can help.
Code:
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]Sub test()[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]sendSMS "646-480-1977", "8583829141", "Sending SMS is easy with Twilio!"[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]End Sub[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]Function sendSMS(fromNumber As String, toNumber As String, body As String)[/FONT][/COLOR]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]'Function RectangleArea(Height As Double, Width As Double) As Double[/FONT][/COLOR]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' replace with your account's settings[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]' available in the Dashboard[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]accountSid = "xxx"[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]authToken = "yyy"[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' setup the URL[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]baseUrl = "[URL="https://api.twilio.com/"][COLOR=#0072c6]https://api.twilio.com[/COLOR][/URL]"[/COLOR][/FONT][COLOR=#2b2e2f]
[FONT=Lucida Sans Unicode]smsUrl = baseUrl & "/2010-04-01/Accounts/" & accountSid & "/SMS/Messages"[/FONT][/COLOR]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' setup the request and authorization[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]Dim http As MSXML2.ServerXMLHTTP60[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]'Set http = Server.CreateObject("MSXML2.ServerXMLHTTP60")[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]Set http = New MSXML2.ServerXMLHTTP60[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]http.Open "POST", smsUrl, False, accountSid, authToken[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' message parameters[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]from = fromNumber ' the number to send the message from[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]recipient = toNumber ' the number to send the message to[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]Dim postData As String[/FONT][/COLOR]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]postData = "From=" & from[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]postData = postData & "&To=" & recipient[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]postData = postData & "&Body=" & body[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' send the POST data[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]http.send postData[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' optionally write out the response if you need to check if it worked[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]' Response.Write http.responseText[/COLOR][/FONT]
[COLOR=#2b2e2f][FONT=Lucida Sans Unicode]' clean up[/FONT][/COLOR]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]Set http = Nothing[/COLOR][/FONT]
[FONT=Lucida Sans Unicode][COLOR=#2b2e2f]End Function[/COLOR][/FONT]
im not sure if putting it in a private function is the correct way but until i know more about private, public etc i would prefer it to be this way. then at least i can edit it and make it what i want to move foreward.
also what will happen. i see 'RectangleArea(Height As Double, Width As Double) As Double'. will this open a rectangle box?
thanks