Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('Simpla.php');
- class smssend extends Simpla
- {
- public function send($phone,$sms)
- {
- $description = iconv('windows-1251', 'utf-8', htmlspecialchars('Моя первая рассылка'));
- $start_time = date("Y-m-d H:i:s");
- $end_time = date("Y-m-d H:i:s", time() + 10800); // плюс 3 часа
- $rate = 120;
- $livetime = 4;
- $source = 'SMS'; // Ваше альфаимя для СМС
- $user = '123'; // Ваш логин
- $password = '123'; // Ваш пароль
- $src ='<?xml version="1.0" encoding="utf-8"?>
- <request>
- <operation>SENDSMS</operation>
- <message start_time="AUTO" end_time="AUTO" livetime="4" rate="120" desc="SMS" source="SMS">
- <body>'.$sms.'</body>
- <recipient>' .$phone. '</recipient>
- </message>
- </request>
- ';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_USERPWD , $user.':'.$password);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_URL, 'http://sms-fly.com/api/api.php');
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml"));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $src);
- $response = curl_exec($ch);
- curl_close($ch);
- // вывод результата
- echo $response;
- return false;
- }
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement