Advertisement
Guest User

api sms-sms.com.ua for simplacms

a guest
Nov 10th, 2013
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('Simpla.php');
  4.  
  5. class smssend extends Simpla
  6. {
  7.     public function send($phone,$sms)
  8.     {
  9.    
  10.     $description = iconv('windows-1251', 'utf-8', htmlspecialchars('Моя первая рассылка'));
  11. $start_time = date("Y-m-d H:i:s");
  12. $end_time = date("Y-m-d H:i:s", time() + 10800); // плюс 3 часа
  13. $rate = 120;
  14. $livetime = 4;
  15. $source = 'SMS'; // Ваше альфаимя для СМС
  16. $user = '123'; // Ваш логин
  17. $password = '123'; // Ваш пароль
  18.  
  19.      $src ='<?xml version="1.0" encoding="utf-8"?>
  20. <request>
  21. <operation>SENDSMS</operation>
  22. <message start_time="AUTO" end_time="AUTO" livetime="4" rate="120" desc="SMS" source="SMS">
  23. <body>'.$sms.'</body>
  24. <recipient>' .$phone. '</recipient>
  25. </message>
  26. </request>
  27. ';
  28.    
  29. $ch = curl_init();
  30. curl_setopt($ch, CURLOPT_USERPWD , $user.':'.$password);
  31. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  32. curl_setopt($ch, CURLOPT_POST, 1);
  33. curl_setopt($ch, CURLOPT_URL, 'http://sms-fly.com/api/api.php');
  34. curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml"));
  35. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  36. curl_setopt($ch, CURLOPT_POSTFIELDS, $src);
  37. $response = curl_exec($ch);
  38. curl_close($ch);
  39.  
  40. // вывод результата
  41.  
  42. echo $response;
  43.  
  44.  
  45.  
  46.  
  47. return false;
  48.  
  49.     }
  50. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement