[Visual fox pro SMS using API]
Visual fox pro uses two method of programming for SMS sending from VFP build applications.
1. Direct Comport Interface with Local or Network server logging tables/database.
Following two method can be used for this type of communication.
a.) From VFP custom build application, directly open the local Comport, & push the SMS to your mobile operator SMS gateway in real time.
b.) Dedicated VFP build SMS pooling (Push) application is hosted on local or network server.
In this way of sending SMS, a log database (tables) is created & used to Que the messages to Push on SMS gateway on FIFO based algorithm. Pooling application can be configured as "service" or "Startup/Scheduled application" on local or server based machine
Multiple applications can send SMS using this shared way.
VFP good SMS pooler example with source code to modify according to your needs :
Vivek Deodhar shows you how to send SMS text messages with VFP. smspooler.zip - Download ID: 225
2. WEB-SMS (Using SMS Gateway on internet via SMS PUSH method)
In this method , all message is composed locally in VFP application (using variables, properties, or textbox etc.) and merged, validated before Pushing to server according to calling Syntax of every Web Gateway server. (for proper syntax refer to documentation of every service provider)
[WEB SMS]
1. UFONE API CODE Example:
Local lcUrl, lcresult
lcUrl="http://bsms.ufone.com/bsms_app4/sendapi.jsp?id=011111111&message=&lcTempTxtFile&shortcode=fox&lang=English&mobilenum=&ccnum&password=12345&groupname=groupname"
**-----------------------*
** Red high lighted variable values will be replaced provided by Ufone against your account.
lcresult = Sms_Push(lcUrl)
wait wind lcresult
RETURN
*------------------------------*
FUNCTION Sms_Push
*-----------------------------*
Lparameters lcurl
Local lcRetstatus, XmlHttpobj As Microsoft.XMLHTTP
lcRetstatus = ""
Try
XmlHttpobj = Createobject("Microsoft.XMLHTTP")
XmlHttpobj.Open("GET", lcurl, .F.)
XmlHttpobj.setRequestHeader("Content-Type", "text/urlencoded")
XmlHttpobj.Send()
If (XmlHttpobj.Status = 404)
lcRetstatus = "Error#: 404"
Else
lcRetstatus = XmlHttpobj.ResponseText
endif
XmlHttpobj = Null
Catch To oErr
lcRetstatus = "Following Error Occurs:"+oErr.Message
endtry
Return lcRetstatus
endfunc
**************----------------------------------------------*******************************
2. SmsGatewayhub.com API CODE Example:
Local lcuser,lcPassword,lcUrl, lcresult
lcUrl="http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user="+lcuser+"&pwd="+lcPassword+"&to="+lcNumber+"&sid="+lcuser+"&msg="+lcMsg+"&fl=0&gwid=2"
**-----------------------*
** Red high lighted variable values will be replaced provided by service provider against your
** account.
lcresult = Sms_Push(lcUrl)
wait wind lcresult
RETURN
*------------------------------*
FUNCTION Sms_Push
*-----------------------------*
Lparameters lcurl
Local lcRetstatus, XmlHttpobj As Microsoft.XMLHTTP
lcRetstatus = ""
Try
XmlHttpobj = Createobject("Microsoft.XMLHTTP")
XmlHttpobj.Open("GET", lcurl, .F.)
XmlHttpobj.setRequestHeader("Content-Type", "text/urlencoded")
XmlHttpobj.Send()
If (XmlHttpobj.Status = 404)
lcRetstatus = "Error#: 404"
Else
lcRetstatus = XmlHttpobj.ResponseText
endif
XmlHttpobj = Null
Catch To oErr
lcRetstatus = "Following Error Occurs:"+oErr.Message
endtry
Return lcRetstatus
endfunc
******************************** Code end *******************
Cheers!
Hope this will help you to choose according to your Requirement of SMS for your VFP Application development !
Visual fox pro uses two method of programming for SMS sending from VFP build applications.
1. Direct Comport Interface with Local or Network server logging tables/database.
Following two method can be used for this type of communication.
a.) From VFP custom build application, directly open the local Comport, & push the SMS to your mobile operator SMS gateway in real time.
b.) Dedicated VFP build SMS pooling (Push) application is hosted on local or network server.
In this way of sending SMS, a log database (tables) is created & used to Que the messages to Push on SMS gateway on FIFO based algorithm. Pooling application can be configured as "service" or "Startup/Scheduled application" on local or server based machine
Multiple applications can send SMS using this shared way.
VFP good SMS pooler example with source code to modify according to your needs :
Vivek Deodhar shows you how to send SMS text messages with VFP. smspooler.zip - Download ID: 225
2. WEB-SMS (Using SMS Gateway on internet via SMS PUSH method)
In this method , all message is composed locally in VFP application (using variables, properties, or textbox etc.) and merged, validated before Pushing to server according to calling Syntax of every Web Gateway server. (for proper syntax refer to documentation of every service provider)
[WEB SMS]
1. UFONE API CODE Example:
Local lcUrl, lcresult
lcUrl="http://bsms.ufone.com/bsms_app4/sendapi.jsp?id=011111111&message=&lcTempTxtFile&shortcode=fox&lang=English&mobilenum=&ccnum&password=12345&groupname=groupname"
**-----------------------*
** Red high lighted variable values will be replaced provided by Ufone against your account.
lcresult = Sms_Push(lcUrl)
wait wind lcresult
RETURN
*------------------------------*
FUNCTION Sms_Push
*-----------------------------*
Lparameters lcurl
Local lcRetstatus, XmlHttpobj As Microsoft.XMLHTTP
lcRetstatus = ""
Try
XmlHttpobj = Createobject("Microsoft.XMLHTTP")
XmlHttpobj.Open("GET", lcurl, .F.)
XmlHttpobj.setRequestHeader("Content-Type", "text/urlencoded")
XmlHttpobj.Send()
If (XmlHttpobj.Status = 404)
lcRetstatus = "Error#: 404"
Else
lcRetstatus = XmlHttpobj.ResponseText
endif
XmlHttpobj = Null
Catch To oErr
lcRetstatus = "Following Error Occurs:"+oErr.Message
endtry
Return lcRetstatus
endfunc
**************----------------------------------------------*******************************
2. SmsGatewayhub.com API CODE Example:
Local lcuser,lcPassword,lcUrl, lcresult
lcUrl="http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user="+lcuser+"&pwd="+lcPassword+"&to="+lcNumber+"&sid="+lcuser+"&msg="+lcMsg+"&fl=0&gwid=2"
**-----------------------*
** Red high lighted variable values will be replaced provided by service provider against your
** account.
lcresult = Sms_Push(lcUrl)
wait wind lcresult
RETURN
*------------------------------*
FUNCTION Sms_Push
*-----------------------------*
Lparameters lcurl
Local lcRetstatus, XmlHttpobj As Microsoft.XMLHTTP
lcRetstatus = ""
Try
XmlHttpobj = Createobject("Microsoft.XMLHTTP")
XmlHttpobj.Open("GET", lcurl, .F.)
XmlHttpobj.setRequestHeader("Content-Type", "text/urlencoded")
XmlHttpobj.Send()
If (XmlHttpobj.Status = 404)
lcRetstatus = "Error#: 404"
Else
lcRetstatus = XmlHttpobj.ResponseText
endif
XmlHttpobj = Null
Catch To oErr
lcRetstatus = "Following Error Occurs:"+oErr.Message
endtry
Return lcRetstatus
endfunc
******************************** Code end *******************
Cheers!
Hope this will help you to choose according to your Requirement of SMS for your VFP Application development !
This comment has been removed by the author.
ReplyDeletethank you very help full and working very fast
ReplyDeleteIt is really good for us thanks very much dear
ReplyDeleteI use this program but string is to long to fit error is coming
ReplyDeleteplease help me
Thanks
Saleem Ahmed
my API setting in prg file is as below
ReplyDeleteLocal lcUrl, lcresult
lcUrl="http://api.dialme24.org/api/Master/DirectProcess?UserEmail=oscschools2a@gmail.com&Password=9278315&UniCode=0&Message=TestMessage&MultipleNumber=7790827143&DndType=DND&SenderID=DIALME&FlashMessage=0"
**-----------------------*
** Red high lighted variable values will be replaced provided by Ufone against your account.
lcresult = Sms_Push(lcurl)
wait wind lcresult
RETURN
*------------------------------*
FUNCTION Sms_Push
*-----------------------------*
Lparameters lcurl
Local lcRetstatus, XmlHttpobj As Microsoft.XMLHTTP
lcRetstatus = ""
Try
XmlHttpobj = Createobject("Microsoft.XMLHTTP")
XmlHttpobj.Open("GET", lcUrl, .F.)
XmlHttpobj.setRequestHeader("Content-Type", "text/urlencoded")
XmlHttpobj.Send()
If (XmlHttpobj.Status = 404)
lcRetstatus = "Error#: 404"
Else
lcRetstatus = XmlHttpobj.ResponseText
endif
XmlHttpobj = Null
Catch To oErr
lcRetstatus = "Following Error Occurs:"+oErr.Message
endtry
Return lcRetstatus
endfunc
but I always get an error as Message as {"Message";"The requested resource does not support http method 'GET',"}
Please help me if is there any mistake in written code please tell me
Thanks
Thanks for shearing this information. It is useful for all. However, there are several online SMS services that have SMS API PHP integration.
ReplyDeleteThanks for sharing this information. An Bulk SMS API is considered one of the most reliable forms of communicating with customers. Therefore, it is important for you to choose providers that offer the best in terms of usage and speed.
ReplyDelete