I have the following xbasic that is giving me an annoying error after a successful send! In other words it works as expected and sends multiple SMS messages but for some reason it still throws the error. I also noticed that for some reason remspecial doesn't seem to work but again this does work as expected and sends all sms messages as expected.
xbasic
error is attached - any thoughts would be helpful!
end-while-error.JPG
xbasic
Code:
FUNCTION SendTw AS C (e as p) debug(1) '==CONNECTION AND VARS dim cn as SQL::Connection dim vHasError as c dim cf_1 as extension::CurlFile dim flag_1 as l dim ce as extension::Curl dim vSendNumber as c dim args as sql::arguments dim vUser as c dim SendTw as c vHasError = "N" cn.open("::Name::Connection1") vTwilioURLPre= "https://api.twilio.com/2010-04-01/Accounts/" vSID = "******" vTwilioURL=vTwilioURLPre+vSID+"/Messages.json" vToken = "*******" vPassword=vSID+":"+vToken vFromNumber="+******" vFrom="&From="+vFromNumber vSubject = "Job Assigments" 'irrelevant really to the SMS args.Add("thedate",convert_type(e._CurrentRowDataNew.Date,"D")) args.Add("coid",e._CurrentRowDataNew.company_id) vSelect = "SELECT Employee_phone, Sending_Data FROM alphanwcopro.send_tasks WHERE Date = :thedate AND company_id = :coid" cn.execute(vSelect,args) ce = extension::Curl.Init() ce.setOpt("URL",vTwilioURL) ce.setOpt("NOPROGRESS",1) ce.setOpt("USERPWD",vPassword) ce.setOpt("USERAGENT","curl/7.34.0") ce.setOpt("MAXREDIRS",50) ce.setOpt("CAINFO","C:\\Program Files (x86)\\a5V12\\CARoot\\ca-cert.pem") ce.setOpt("CAPATH","C:\\Program Files (x86)\\a5V12\\CARoot") ce.setOpt("CUSTOMREQUEST","POST") ce.setOpt("TCP_KEEPALIVE",1) while eval_valid(cn.ResultSet.data("Employee_phone")) vSendNumber= cn.ResultSet.data("Employee_phone") vMessage = cn.ResultSet.data("Sending_Data") vTo="&To=+1"+remspecial(vSendNumber) vBody = "Body="+urlencode(vMessage) vPostFields=vBody+vFrom+vTo ce.setOpt("POSTFIELDS",vPostFields) ce.SetOpt("FILE",cf_1) flag_1 = ce.Exec() flag_1 = cn.ResultSet.NextRow() end while ce.close() cn.Close() end function
error is attached - any thoughts would be helpful!
end-while-error.JPG
Comment