Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,897 members, 7,802,891 topics. Date: Saturday, 20 April 2024 at 01:55 AM

How To Integrate Sms To A Online Registration Form (php, Html, Aspx Etc) - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How To Integrate Sms To A Online Registration Form (php, Html, Aspx Etc) (1555 Views)

New Nigerian Stock Exchange Website (Moved from jsp to aspx) / How To Integrate Sms To A Online Registration Form (php, Html, Aspx Etc) / Tutorial: How To Integrate SMS Functionality on Your Website Using Asp.net (2) (3) (4)

(1) (Reply)

How To Integrate Sms To A Online Registration Form (php, Html, Aspx Etc) by original2k: 6:13pm On Jan 26, 2012
Hello nairalanders, i need an idea on how i can integrate sms to a online registration form (php, html, aspx etc). please fill me with your ideas, remember the api must not show ones user and password so i need your ideas. thanks
Re: How To Integrate Sms To A Online Registration Form (php, Html, Aspx Etc) by Bros1: 6:57pm On Jan 26, 2012
You can use this my code. It's is vb and from one of my applications. Though i've tried simplifying it. It basically creates a webrequest using the parameters from ur provider as a string. It send the request to the web server and get the response as sending status.

For more assistance, you can email me at david.adele@codebasetechnologies.com or +2348035133522. Thanks


Option Strict On
Imports Microsoft.VisualBasic
Imports System.Xml
Imports System.Net
Imports System.IO
Imports LogissTableAdapters
Imports System.Web.UI


Public Class SMSEngine
Private noOfsms As Integer = Nothing
Private SMSSent As Integer = Nothing

Function SendSMS(ByVal sender As String, ByVal message As String, ByVal destination As String) As String
Dim genid As String = ChrW(34) & GetUniqueCode() & ChrW(34)

'Dim xml1 As String = "<SMS><authentification><username>youremail@yahoo.co.uk</username><password>yourpass</password></authentification><message><sender>" & TextBox2.Text & "</sender><msgtext>" & TbMessage.Text & "</msgtext></message><recipients><gsm>" & TextBox3.Text & "</gsm></recipients></SMS>"
Dim xml1 As String = "<SMS><authentification><username>youremail@yahoo.co.uk</username><password>yourpass</password></authentification><message><sender>" & sender & "</sender><msgtext>" & message & "</msgtext><flash>1</flash><sendtime></sendtime><listname></listname></message><recipients><gsm messageId=" & genid & ">" & destination & "</gsm></recipients></SMS>" & ""


Dim url As String = "http://www.codebasetechnologies.com/tools/xml/Sms.php"
Dim request As WebRequest = WebRequest.Create(url)

request.Method = "Post"

request.ContentType = "text/xml"

'The encoding might have to be chaged based on requirement

Dim encoder As New UTF8Encoding()

Dim data() As Byte = encoder.GetBytes(xml1) 'postbody is plain string of xml

request.ContentLength = data.Length
request.Timeout = 6000000
Dim reqStream As Stream = request.GetRequestStream()

reqStream.Write(data, 0, data.Length)

reqStream.Close()

Dim response As System.Net.WebResponse = request.GetResponse()

Dim reader As New System.IO.StreamReader(response.GetResponseStream())

Dim str As String = reader.ReadToEnd()
'Label1.Text = "Message sent"
response.Close()
Return str


'record the sms into the database. Note you may omit this or implement it own way
'Try
' Dim count As Integer = Nothing

' Dim y As New SMSStatisticsTableAdapter
' y.Insert(count, False, Membership.GetUser.UserName, DateTime.Now, message)
'Catch ex As Exception
' 'response.write("message sent but not saved into the system" & ex.Message)
'End Try



End Function

Private Function GetUniqueCode() As String

'Dim allChars As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
Dim allChars As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
Dim GotUniqueCode As Boolean = False
Dim uniqueCode As String = ""

'While Not GotUniqueCode


Dim str As New System.Text.StringBuilder

For i As Byte = 1 To 10 'length of req key
Dim xx As Integer
Randomize()
xx = CInt(Rnd() * (Len(allChars) - 1)) 'number of rawchars
str.Append(allChars.Trim.Chars(xx))
Next

' IsUniqueCode check that the unique value is not already in the database
uniqueCode = str.ToString
Return uniqueCode
End Function
End Class

1 Like

(1) (Reply)

Can I Get A Godaddy Domain Name With Firstbank Verve Or Mastercard? / . / DATA

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 28
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.