VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Send SMS message via Http for free

by Klemens Schmid (9 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (10 Votes)

Sends an SMS message to a cell phone for free. It makes use of the ServerXMLHTTP object contained in msxml3.dll. Uses the free German Web service www.billiger-telefonieren.de. The cookie checks of the site are circumvented by doing the cookie
handling explicitely. Therefore this code should work even server-side!
Please note that the site still puts some requirement on the send message. For example messages with subjects like "test" are rejected.
And: you can't send more than a certain number of messages to the the same number.
For the most recent updates please visit my homepage.
New information (30-Oct-02): I uploaded my third generation of SMS code under "SMS via HTTP - third generation".

Inputs
1. Message text (up to 160 chars) 2. Phone number (e.g. +49171xxxxxx)
Assumes
I used it with Microsoft msxml3.dll (the released version). Download it from http://msdn.microsoft.com/xml/default.asp.
Code Returns
Comes back with a success or a failure message depending on the HTML that the site returns.

Rate Send SMS message via Http for free

'Author
' mailto:[email protected], http://www.schmidks.de
'Description
' This code fires off an SMS message to the given phone number
' It makes use of the German service "www.billiger-telefonieren.de"
' The cookie checks of the site are circumvented by doing the cookie
' handling explicitely. Therefore this code should work even server-side!
' Please note that the site still puts some requirement on the send
' message. For example messages with subjects like "test" are rejected.
' And: you can't send more than a certain number of messages to the
' the same number.
'Prerequisites
' The posting is done thru the ServerXMLHTTP object which is contained
' in the Microsoft XML object msxml3.dll. Install this from
' http://msdn.microsoft.com/xml/default.asp.
Option Explicit
Public Sub SendSMS()
Dim strText As String
Dim strPhoneNo As String
Dim strCookie As String
Dim oHttp As ServerXMLHTTP
'make use of the XMLHTTPRequest object contained in msxml.dll
Set oHttp = CreateObject("msxml2.serverXMLHTTP")
'enter your data
strText = InputBox("Text:", "Send Text via SMS", "vbsms:")
strPhoneNo = InputBox("Phone Number:", "Send Text via SMS")
'fire of an http request to request for a cookie
oHttp.open "GET", "http://www.billiger-telefonieren.de/sms/send.php3?action=accept", False
oHttp.send
strCookie = oHttp.getResponseHeader("set-cookie")
strCookie = Left$(strCookie, InStr(strCookie, ";") - 1)
'better check the feedback
Debug.Print oHttp.responseText
'do the actual send
oHttp.open "POST", "http://www.billiger-telefonieren.de/sms/send.php3", False
oHttp.setRequestHeader "Cookie", strCookie
'we need to do it a second time due to KB article Q234486.
oHttp.setRequestHeader "Cookie", strCookie
oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oHttp.send "action=send&number=" & strPhoneNo & "&email=&message=" & strText
Debug.Print oHttp.responseText
If InStr(oHttp.responseText, "erfolgreich eine Nachricht an die") Then
 MsgBox "Message has been sent successfully", vbInformation
Else
 MsgBox "Service refused to send the message", vbCritical
End If
End Sub

Download this snippet    Add to My Saved Code

Send SMS message via Http for free Comments

No comments have been posted about Send SMS message via Http for free. Why not be the first to post a comment about Send SMS message via Http for free.

Post your comment

Subject:
Message:
0/1000 characters