phatjk

Code Send SMS

Sep 10th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Document</title>
  6.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  7. </head>
  8. <body>
  9.     <script type="text/javascript">
  10. var p = {
  11.     "phone1": "84907193016"
  12. };
  13. for (var key in p) {
  14.     if (p.hasOwnProperty(key)) {
  15.         var phone_number = p[key];
  16.         var message = "Test SMS";
  17.         var device_id = 1;
  18.         var obj = [{
  19.             "phone_number": phone_number,
  20.             "message": message,
  21.             "device_id": device_id
  22.         }];
  23.         var mydata = JSON.stringify(obj);
  24.         var settings = {
  25.             "async": true,
  26.             "crossDomain": true,
  27.             "url": "https://smsgateway.me/api/v4/message/send",
  28.             "method": "POST",
  29.             "headers": {
  30.                 "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhZG1pbiIsImlhdCI6MTUzNjU4NDczMiwiZXhwIjo0MTAyNDQ0ODAwLCJ1aWQiOjYwOTM0LCJyb2xlcyI6WyJST0xFX1VTRVIiXX0.tiKDXvN-LzdKFjxN_2BI0oJ09dMpaBJey0CKdRbAcFU",
  31.                 "Content-Type": "application/json",
  32.             },
  33.             "processData": false,
  34.             data: mydata
  35.         }
  36.         $.ajax(settings).done(function(response) {
  37.             console.log(response);
  38.         });
  39.     }
  40. }
  41.     </script>
  42. </body>
  43. </html>
Add Comment
Please, Sign In to add comment