here's my sendsmsvianexmo.prg
LPARAMETERS tcPhoneNumber, tcMessage
NexmoKey = ALLTRIM(oAppInfo.SMSProviderKey)
NexmoSecret = ALLTRIM(oAppInfo.SMSProviderSecret)
NexmoNumber = ALLTRIM(oAppInfo.SMSProviderNumber)
m.lcNexmoUrl = TEXTMERGE(oAppinfo.SMSProviderURL)
TrySendSMS(m.tcPhoneNumber, m.tcMessage, m.lcNexmoUrl)
Procedure TrySendSMS(tcPhone,tcMessage, tcNexmoUrl)
tcMessage = Strtran(m.tcMessage, '%0A', '%0D%0A')
lcUrl = Chrtran(;
Textmerge("<< m.tcNexmoUrl >>|to=<< m.tcPhone >>|text=<<
m.tcMessage >>"), '|', Chr(38))
Local loXmlHttp As "Microsoft.XMLHTTP"
loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
loXmlHttp.Open( "POST" , m.lcUrl, .F. )
loXmlHttp.Send( )
XMLTOCURSOR(loXmlHttp.responsetext, "SMSResult", 512)
*!* BROWSE NORMAL
&& 200 success code
*!* ? loXmlHttp.responsetext
RETURN loXmlHttp.Status = 200
Endproc
This is my SendSMSViaTwilio.prg
LPARAMETERS tcPhoneNumber, tcMessage
m.lcURL = TEXTMERGE(oAppinfo.SMSProviderURL)
m.lcTo = m.tcPhoneNumber
m.lcFrom = oAppinfo.SMSProviderNumber
m.AccountSID = oAppInfo.SMSProviderKey
m.AuthToken = oAppInfo.SMSProviderSecret
m.lcString = [From=] + m.lcFrom ;
+ [&To=] + m.lcTo;
+ [&Body="] + m.tcMessage + ["]
loHTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")
loHTTP.Open("POST", m.lcUrl , .F.)
loHTTP.SetCredentials(AccountSID, AuthToken, 0)
loHTTP.SetRequestHeader("content-type", "application/x-www-form-urlencoded")
loHTTP.Send(m.lcString)
XMLTOCURSOR(loHttp.responsetext, "SMSResult", 0)
IF FILE("debug.txt")
STRTOFILE(loHttp.responsetext, "Twilio Log.xml", 0)
ENDIF
* not sure how I check for success!
RETURN .T.
SET LIBRARY TO vfpconnection.fll ADDITIVE
*!* ?HttpSimplePost("https://api.twilio.com/2010-04-01/Accounts/" +
AccountSID + "/Messages/" + AuthToken + ".json", m.lcjson, "", "MyTrace()")
*!* RETURN
*!* SetConnectTimeout(oAppInfo.ConnectTimeOut) && Default is 10 seconds
*!* SetResponseTimeout(oAppInfo.ResponseTimeOut) && Default is 10 seconds
SetConnectTimeout(30) && Default is 10 seconds
SetResponseTimeout(30) && Default is 10 seconds
*!*
https://api.twilio.com/2010-04-01/Accounts/ACb832550f3d5e416b54a3ff1c0c7d08b1/Messages.json
\
*!* -d "Body=Jenny%20please%3F%21%20I%20love%20you%20<3" \
*!* -d "To=%2B15558675309" \
*!* -d "From=%2B14158141829" \
*!* -d "MediaUrl=http://www.example.com/hearts.png" \
*!* -u 'ACb832550f3d5e416b54a3ff1c0c7d08b1:{AuthToken}'
m.lcURL = "https://api.twilio.com/2010-04-01/Accounts/" + AccountSID +
"/Messages/.json"
*!*
"https://api.twilio.com/2010-04-01/Accounts/ACaaff12cbe9e61de8b2425620cf2c26c7/Messages"
&&oAppInfo.PostClaimDocumentURL
LOCAL ARRAY laPost[3,2]
laPost[1,1] = "Body"
laPost[1,2] = "Test Message from Frank via Twilio"
laPost[2,1] = "To" && name
laPost[2,2] = "+18683766400"
laPost[3,1] = "From" && name
laPost[3,2] = "+18683766400"
IF NOT HttpPost(m.lcURL, @laPost, "", "APITrace()")
MESSAGEBOX("An error occurred sending the SMS: " + m.cTraceData,
16, "Send SMS Via Twilio")
ENDIF
***********************
FUNCTION APITrace() && Callback from the FLL - used to provide a
detailed trace of the operation
***********************
*!* You can create your own function, procedure or method to handle
this and name it whatever you want.
*!* The nTraceDataType and cTraceData are private variables created
on-the-fly by the FLL
#DEFINE TYPE_TEXT 0
#DEFINE TYPE_HEADER_IN 1
#DEFINE TYPE_HEADER_OUT 2
#DEFINE TYPE_DATA_IN 3
#DEFINE TYPE_DATA_OUT 4
#DEFINE TYPE_SSL_DATA_IN 5
#DEFINE TYPE_SSL_DATA_OUT 6
#DEFINE TYPE_END 7
lcMessage = ICASE(m.nTraceDataType = TYPE_TEXT, "STATUS:", ;
m.nTraceDataType = TYPE_HEADER_IN, "<RECV HEADER: ", ;
m.nTraceDataType = TYPE_HEADER_OUT, ">SEND HEADER: ", ;
m.nTraceDataType = TYPE_DATA_IN, "<RECV DATA: ", ;
m.nTraceDataType = TYPE_DATA_OUT, ">SEND DATA: ", ;
m.nTraceDataType = TYPE_SSL_DATA_IN, "<RECV SSL DATA: ", ;
m.nTraceDataType = TYPE_SSL_DATA_OUT, ">SEND SSL DATA: ", ;
m.nTraceDataType = TYPE_END, "END: ", "UNKNOWN: ")
m.lcMessage = m.lcMessage + m.cTraceData
STRTOFILE(m.lcMessage, "Twilio.log", 1)
ENDFUNC
Frank.
Frank Cazabon
On 07/07/2017 12:50 AM, [email protected] wrote:
On 2017-07-06 16:38, Brian wrote:
https://martinfitzpatrick.name/list-of-email-to-sms-gateways/
go to that link and have a look at it. it should give you the email
to text gateway to just about every carrier.
Thanks, Brian. Yes, that shows the ones I listed in that screenshot
earlier (and of course gazillion more!).
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.