PHP class sms.ru sender

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
class SmsSend {
public $api_id;
public $number;
public $text;
public function send($number, $text) {
$text = str_replace(" ", "+", $text);
$res = file_get_contents("http://sms.ru/sms/send?api_id=".$this->api_id."&to=".$number."&text=".$text);
if(!preg_match("/100/", $res, $rs)) echo "Error! Code - ".$res;
else echo "Success.";
}
}
$sms = new SmsSend();
$sms->api_id = "YOUR_API_ID";
$sms->send("PHONE_NUMBER", "SMS_TEXT");