Thank you very much for guiding me.
I could achieve my requirement as under (might be in a crude way.. )
Code: Select all
#include "FiveWin.ch"
FUNCTION Send_SMS()
LOCAL cMessage := "Hi, ప్రియమైన తల్లి తండ్రులారా, మీ విద్యార్ధి ఈ రోజు అనగా 21-09-2019 న పాఠశాలకు హాజరు కాలేదని దయచేసి గుర్తించగలరు."+;
"-ఇట్లు ప్రధాన ఉపాధ్యాయుడు."+;
"Dear Parent, Please note that your Son is absent to the " +;
"School on 21-09-2019. Please ensure his regular presence. " +;
"-Principal"
LOCAL cUrl := "http://smslogin.mobi/spanelv2/api.php?username=rameshbabup"+;
"&password=ramesh@1209&from=AKSHAR&to=9885302775&message="
LOCAL cRetVal
FW_SetUniCode(.T.)
cMessage := Percentage_Encoding(cMessage)
cUrl := cUrl + cMessage
cRetVal := WFReadURL(cUrl)
MsgInfo(cRetVal)
RETURN nil
******************************************************************************
*** FUNCTION Percentage_Encoding(cString) - To Percent Encoding after ***
*** Converting the Original ***
*** Message with StrToHex(cMessage)***
******************************************************************************
FUNCTION Percentage_Encoding(cString)
LOCAL cConverted := "%", n, cChar
* First convert the String to Hex
cString := StrToHex(cString)
* And insert % before every two characters
FOR n = 1 TO LEN(cString) STEP 2
cChar := SUBSTR(cString,n,2)
cConverted += cChar+"%"
NEXT
* Finally encode the leftover Reserved Characters
cString := EnCode_Reserved(cString)
RETURN cConverted
******************************************************************************
*** FUNCTION EnCode_Reserved(cString) - To Encode Reserved characters ***
*** after Percent Encoding ***
******************************************************************************
FUNCTION EnCode_Reserved(cString)
LOCAL nPos := 0, cEncodedChar := "", n
LOCAL aReserved := {{"!","%21"},;
{"#","%23"},;
{"$","%24"},;
{"%","%25"},;
{"&","%26"},;
{"'","%27"},;
{"(","%28"},;
{")","%29"},;
{"*","%2A"},;
{"+","%2B"},;
{",","%2C"},;
{"/","%2F"},;
{":","%3A"},;
{";","%3B"},;
{"=","%3D"},;
{"?","%3F"},;
{"@","%40"},;
{"[","%5B"},;
{"]","%5D"},;
{CHR(12),"%0A%0D%0D0A"},;
{" ","%20"},;
{'"',"%22"},;
{"-","%2D"},;
{".","%2E"},;
{"<","%3C"},;
{">","%3E"},;
{"\","%5C"},;
{"^","%5E"},;
{"_","%5F"},;
{"`","%60"},;
{"{","%7B"},;
{"|","%7C"},;
{"}","%7D"},;
{"~","%7E"},;
{"£","%C2%A3"}}
FOR n = 1 TO LEN(cString)
nPos := ASCAN(aReserved, SUBSTR(cString,n,1))
IF nPos >0
cString := Stuff(cString,n,3,aReserved[nPos,2])
ENDIF
NEXT
RETURN cString
*****************************************************************************
FUNCTION WFReadURL(cUrl)
LOCAL cPageContent := "Error: " + cUrl + " not found or timed out."
LOCAL oConn, oHttp
IF oHttp = nil
oHttp := TOleAuto():New("Msxml2.ServerXMLHTTP")
ENDIF
TRY
oHttp:Open("PUT", cUrl, .F.)
oHttp:Send("Post Data")
cPageContent := oHttp:ResponseText
IF FILE("http.log")
ERASE http.log
ENDIF
CATCH
cPageContent := "Error opening SMS Gateway"
END
RETURN cPageContent
*****************************************************************************