Advertisement
SJaafar

Send O2SMS using vba

Sep 18th, 2023
1,785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 12.27 KB | None | 0 0
  1. Option Compare Database
  2.  
  3. Function sendSMS(aStudent As Student) As String
  4.    
  5.     Dim USERUNICODE As String
  6.     Dim PASSUNICODE As String
  7.     Dim MSGUNICODE As String
  8.     Dim USER As String
  9.     Dim PASS As String
  10.     Dim MSG As String
  11.    
  12.     USER = "durazsch"
  13.     USERUNICODE = UNICODEUTFTARIQ(USER)
  14.    
  15.    ' MsgBox USERUNICODE
  16.    'USER = "0064007500720061007a007300630068"
  17.    PASS = "Mohd92"
  18.     PASSUNICODE = UNICODEUTFTARIQ(PASS)
  19.    
  20.    ' MsgBox PASSUNICODE
  21.    'PASS = "006d006f0068006400390032"
  22.    
  23.     MSG = "áÞÏÊÃÎÑ" & _
  24.     aStudent.StudentName & " ¡" & _
  25.     Format(aStudent.ArriveTime, "hh:mm") & _
  26.     "¡ááãÑÉ" & aStudent.num & "¡äÑÌæÍËå Úáì ÇáÊÈßíÑ"
  27.    
  28.     MSGUNICODE = UNICODEUTFTARIQ(MSG)
  29.    
  30.    ' MsgBox MSGUNICODE
  31.    
  32.    
  33.    
  34.     Dim strUrl As String
  35.     strUrl = "http://www.o2sms.net/RemoteAPI/SendSMS.aspx?" & _
  36.             "username=" & USERUNICODE & _
  37.             "&password=" & PASSUNICODE & _
  38.             "&messagedata=" & MSGUNICODE & _
  39.             "&receiver=973" & aStudent.tel
  40.    
  41.    
  42.    
  43.    
  44.     Dim hReq As Object
  45.  
  46. 'create our URL string and pass the user entered information to it
  47.    
  48.    ' MsgBox strUrl
  49.    Set hReq = CreateObject("MSXML2.XMLHTTP")
  50.         With hReq
  51.             .Open "GET", strUrl, False
  52.             .send
  53.         End With
  54.     sendSMS = hReq.ResponseText
  55. 'wrap the response in a JSON root tag "data" to count returned objects
  56.    Dim response As String
  57.     response = "{""data"":" & hReq.ResponseText & "}"
  58.    
  59.    
  60.    
  61.     Set hReq = Nothing
  62.    
  63.    
  64.    'sssssssssssssssssssssssssssssss
  65.    
  66.    
  67. End Function
  68.  
  69. Function UNICODEUTFTARIQ(strOriginalString2 As String) As String
  70. On Error GoTo UNICODEUTFTARIQ_Err
  71. Dim intLoop2 As Integer
  72. Dim strChar2 As String
  73.  
  74. For intLoop2 = 1 To Len(strOriginalString2)
  75. strChar2 = Mid$(strOriginalString2, intLoop2, 1)
  76.    
  77.    Select Case (Asc(strChar2))
  78.       Case 10
  79.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "000a"
  80.       Case 13
  81.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "000d"
  82.       Case 32
  83.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0020"
  84.       Case 33
  85.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0021"
  86.       Case 34
  87.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0022"
  88.       Case 35
  89.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0023"
  90.       Case 36
  91.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0024"
  92.       Case 37
  93.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0025"
  94.       Case 38
  95.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0026"
  96.       Case 39
  97.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0027"
  98.       Case 40
  99.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0028"
  100.       Case 41
  101.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0029"
  102.       Case 42
  103.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "002a"
  104.       Case 43
  105.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "002b"
  106.       Case 44
  107.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "002c"
  108.       Case 45
  109.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "002d"
  110.       Case 46
  111.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "002e"
  112.       Case 47
  113.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "002f"
  114.       Case 48
  115.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0030"
  116.       Case 49
  117.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0031"
  118.       Case 50
  119.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0032"
  120.       Case 51
  121.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0033"
  122.       Case 52
  123.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0034"
  124.       Case 53
  125.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0035"
  126.       Case 54
  127.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0036"
  128.       Case 55
  129.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0037"
  130.       Case 56
  131.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0038"
  132.       Case 57
  133.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0039"
  134.       Case 58
  135.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "003a"
  136.       Case 59
  137.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "003b"
  138.       Case 60
  139.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "003c"
  140.       Case 61
  141.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "003d"
  142.       Case 62
  143.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "003e"
  144.       Case 63
  145.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "003f"
  146.       Case 64
  147.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0040"
  148.       Case 65
  149.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0041"
  150.       Case 66
  151.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0042"
  152.       Case 67
  153.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0043"
  154.       Case 68
  155.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0044"
  156.       Case 69
  157.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0045"
  158.       Case 70
  159.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0046"
  160.       Case 71
  161.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0047"
  162.       Case 72
  163.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0048"
  164.       Case 73
  165.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0049"
  166.       Case 74
  167.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "004a"
  168.       Case 75
  169.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "004b"
  170.       Case 76
  171.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "004c"
  172.       Case 77
  173.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "004d"
  174.       Case 78
  175.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "004e"
  176.       Case 79
  177.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "004f"
  178.       Case 80
  179.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0050"
  180.       Case 81
  181.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0051"
  182.       Case 82
  183.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0052"
  184.       Case 83
  185.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0053"
  186.       Case 84
  187.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0054"
  188.       Case 85
  189.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0055"
  190.       Case 86
  191.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0056"
  192.       Case 87
  193.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0057"
  194.       Case 88
  195.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0058"
  196.       Case 89
  197.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0059"
  198.       Case 90
  199.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "005a"
  200.       Case 91
  201.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "005b"
  202.       Case 92
  203.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "005c"
  204.       Case 93
  205.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "005d"
  206.       Case 94
  207.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "005e"
  208.       Case 95
  209.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "005f"
  210.       Case 96
  211.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0060"
  212.       Case 97
  213.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0061"
  214.       Case 98
  215.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0062"
  216.       Case 99
  217.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0063"
  218.       Case 100
  219.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0064"
  220.      Case 101
  221.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0065"
  222.      Case 102
  223.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0066"
  224.      Case 103
  225.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0067"
  226.      Case 104
  227.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0068"
  228.      Case 105
  229.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0069"
  230.      Case 106
  231.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "006a"
  232.      Case 107
  233.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "006b"
  234.      Case 108
  235.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "006c"
  236.     Case 109
  237.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "006d"
  238.      Case 110
  239.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "006e"
  240.      Case 111
  241.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "006f"
  242.      Case 112
  243.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0070"
  244.      Case 113
  245.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0071"
  246.      Case 114
  247.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0072"
  248.      Case 115
  249.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0073"
  250.      Case 116
  251.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0074"
  252.      Case 117
  253.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0075"
  254.      Case 118
  255.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0076"
  256.      Case 119
  257.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0077"
  258.      Case 120
  259.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0078"
  260.      Case 121
  261.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0079"
  262.      Case 122
  263.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "007a"
  264.      Case 123
  265.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "007b"
  266.      Case 124
  267.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "007c"
  268.      Case 125
  269.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "007d"
  270.      Case 126
  271.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "007e"
  272. ''' ' '''''''''''''''''''''''''''''''''''''''''''''''''
  273.     Case 145
  274.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "2018"
  275.      Case 146
  276.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "2019"
  277.      Case 161
  278.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "060c"
  279.      Case 167
  280.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "00a7"
  281.      Case 169
  282.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "00a9"
  283.      Case 174
  284.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "00ae"
  285.      Case 186
  286.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "061b"
  287.      Case 191
  288.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "061f"
  289.      Case 193
  290.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0621"
  291.      Case 194
  292.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0622"
  293.      Case 195
  294.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0623"
  295.      Case 196
  296.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0624"
  297.      Case 197
  298.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0625"
  299.      Case 198
  300.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0626"
  301.      Case 199
  302.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0627"
  303.      Case 200
  304.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0628"
  305.      Case 201
  306.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0629"
  307.      Case 202
  308.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "062a"
  309.      Case 203
  310.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "062b"
  311.      Case 204
  312.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "062c"
  313.      Case 205
  314.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "062d"
  315.      Case 206
  316.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "062e"
  317.     Case 207
  318.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "062f"
  319.      Case 208
  320.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0630"
  321.      Case 209
  322.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0631"
  323.      Case 210
  324.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0632"
  325.      Case 211
  326.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0633"
  327.      Case 212
  328.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0634"
  329.      Case 213
  330.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0635"
  331.      Case 214
  332.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0636"
  333.      Case 215
  334.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "00d7"
  335.      Case 216
  336.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0637"
  337.      Case 217
  338.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0638"
  339.      Case 218
  340.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0639"
  341.      Case 219
  342.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "063a"
  343.      Case 220
  344.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0640"
  345.      Case 221
  346.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0641"
  347.      Case 222
  348.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0642"
  349.      Case 223
  350.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0643"
  351.      Case 225
  352.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0644"
  353.      Case 227
  354.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0645"
  355.      Case 228
  356.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0646"
  357.      Case 229
  358.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0647"
  359.      Case 230
  360.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0648"
  361.      Case 236
  362.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0649"
  363.      Case 237
  364.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "064a"
  365.      Case 240
  366.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "064b"
  367.      Case 241
  368.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "064c"
  369.      Case 242
  370.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "064d"
  371.      Case 243
  372.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "064e"
  373.      Case 245
  374.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "064f"
  375.      Case 246
  376.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0650"
  377.      Case 247
  378.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "00f7"
  379.      Case 248
  380.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0651"
  381.      Case 250
  382.       UNICODEUTFTARIQ = UNICODEUTFTARIQ & "0652"
  383. Case Else
  384. MsgBox "íæÌÏ ÍÑÝ Ýí ÇáäÕ  Çæ ßËÑ áã íÊÚÑÝ Úáíå ÇáßæÏ ... åÐÇ ÇáßæÏ ãÎÕÕ ááÛÉ ÇáÚÑÈíÉ æÇáÇäÌáíÒíÉ ÝÞØ ÓíÊã ÇáÛÇÁ ÇáÇÌÑÇÁ ... æÔßÑÇ " & vbCrLf & " íãßäß ÇáÇÑÓÇá ãä ÇáãæÞÚ ãÈÇÔÑÉ ÇáÍÑÝ ÇáÛíÑ ãÞÈæá åæ " & vbCrLf & Chr(Asc(strChar2)), vbExclamation, "ÎÇÑÌ ÇáäØÇÞ"
  385. UNICODEUTFTARIQ = ""
  386.  UNICODEUTFTARIQ = Trim(UNICODEUTFTARIQ)
  387.  
  388. Exit Function
  389. End Select
  390. Next intLoop2
  391.  
  392.  
  393. UNICODEUTFTARIQ_Exit:
  394.     Exit Function
  395.  
  396. UNICODEUTFTARIQ_Err:
  397.     MsgBox Error$
  398.     Resume UNICODEUTFTARIQ_Exit
  399.  
  400. End Function
  401.  
  402.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement