Author | Topic: SENDING SMS | |
---|---|---|
JAYARAM MYSORE | SENDING SMS on Sat, 09 Jan 2010 06:37:39 +0530 I am migrating from Clipper 87 and my application is hybrid I do not have Alaska Xbase Professional. I am able to send SMS using the function writen below. I can send SMS, On the screen I get the response. But How do I capture the response and act accordingly? I am not familar with Class and Methods. FUNCTION SMSCOUNTRY PARAMETER SMSTo, cTxt, JS oDlg := XbpDialog():new( Appdesktop() ) oDlg:title := "SMS STATUS" oDlg:taskList := .T. oDA := oDlg:drawingArea oDlg:create( ,, {50,50}, {640,480},, .F. ) oHTML := XbpHTMLViewer():new( oDA ) oHTML:create( ,, {10,10},{450,300} ) SMSTo = "91"+ALLTRIM(SMSTo) HTTPUSH2 ="http://www.smscountry.com/SMSCwebservice.asp?User=mysorejayaram&passwd=QWER4321&mobilenumber="+ALLTRIM(SMSTo) oHTML:navigate(HTTPUSH2) oDlg:show() INKEY(5) oDlg:destroy() RETURN .T. | |
Pablo Botella | Re: SENDING SMS on Sat, 09 Jan 2010 22:50:58 +0100 Hi, Maybe better to use my free wrapper for the ServerXMLHTTPRequest interface http://news.xbwin.com/newsgroups.php?art_group=ot4xb.examples&article_id=26 #include "ot4xb.ch" --------------------------------------------------------------------------- init proc _main_init_proc_ ; @ole32:OleInitialize(0) ; return exit proc _main_exit_proc_ ; @ole32:OleUninitialize(); return --------------------------------------------------------------------------- function cSendSms( cNumber,cUser,cPwd) local oHttp := TServerXMLHTTPRequest():New() local v,n local cResult := NIL local cUrl := cPrintf( "http://www.smscountry.com/SMSCwebservice.asp?User=%s&passwd=%s&mobilenumber=%s",cUser,cPwd,cNumber) oHttp:Open("GET",cUrl) if oHttp:Send() cResult := oHttp:responseText end oHttp:Release() return cResult --------------------------------------------------------------------------- Also you can use the Phil Ide's LoadFromUrl function with similar results http://www.idep.nl/ Regards, Pablo Botella | |
Pablo Botella | Re: SENDING SMS on Sat, 09 Jan 2010 23:16:14 +0100 oops forgot to forgot to add the message param and urlencode the strings here the wright version #include "ot4xb.ch" --------------------------------------------------------------------------- init proc _main_init_proc_ ; @ole32:OleInitialize(0) ; return exit proc _main_exit_proc_ ; @ole32:OleUninitialize(); return --------------------------------------------------------------------------- static function _urlenc(cStr) local p,cc DEFAULT cStr := "" p := @ot4xb:ot4xb_urlencode(cStr,Len(cStr),0) cc := PeekStr(p,,-1) _xfree(p) return cc --------------------------------------------------------------------------- function cSendSms( cNumber,cMsg,cUser,cPwd) local oHttp := TServerXMLHTTPRequest():New() local v,n local cResult := NIL local cUrl := "http://www.smscountry.com/SMSCwebservice.asp" local cRequest := cPrintf( "%s?User=%s&passwd=%s&mobilenumber=%s&message=%s",; cUrl,_urlenc(User),_urlenc(cPwd),_urlenc(cNumber),_urlenc(cMsg) ) oHttp:Open("GET",cUrl) if oHttp:Send() cResult := oHttp:responseText end oHttp:Release() return cResult --------------------------------------------------------------------------- | |
JAYARAM MYSORE | Re: SENDING SMS on Sun, 10 Jan 2010 07:38:26 +0530 Mr.Pablo Botella, Thanks a lot for your help. It should be : oHttp:Open("GET",cRequest) instead of oHttp:Open("GET",cUrl) Regards Jayaram "Pablo Botella" <pb_no_spam_@_remove_all_betwen_underscores_xbwin.com> wrote in message news:33bfa094$7da68ee5$44229@news.alaska-software.com... > oops forgot to forgot to add the message param and urlencode the strings > here the wright version > > > #include "ot4xb.ch" > --------------------------------------------------------------------------- > init proc _main_init_proc_ ; @ole32:OleInitialize(0) ; return > exit proc _main_exit_proc_ ; @ole32:OleUninitialize(); return > --------------------------------------------------------------------------- > static function _urlenc(cStr) > local p,cc > DEFAULT cStr := "" > p := @ot4xb:ot4xb_urlencode(cStr,Len(cStr),0) > cc := PeekStr(p,,-1) > _xfree(p) > return cc > --------------------------------------------------------------------------- > function cSendSms( cNumber,cMsg,cUser,cPwd) > local oHttp := TServerXMLHTTPRequest():New() > local v,n > local cResult := NIL > local cUrl := "http://www.smscountry.com/SMSCwebservice.asp" > local cRequest := cPrintf( > "%s?User=%s&passwd=%s&mobilenumber=%s&message=%s",; > > cUrl,_urlenc(User),_urlenc(cPwd),_urlenc(cNumber),_urlenc(cMsg) ) > oHttp:Open("GET",cUrl) > if oHttp:Send() > cResult := oHttp:responseText > end > oHttp:Release() > return cResult > --------------------------------------------------------------------------- > | |
Pablo Botella | Re: SENDING SMS on Sun, 10 Jan 2010 10:43:53 +0100 > It should be : > oHttp:Open("GET",cRequest) Yes, I was push the send button before review |