Нашел, модуль, он не очень корректно работает, хочу от туда взять отправку.
Вот рабочая функция отправки
private function sms_send($api_id, $to=0, $text=0, $sender='') {
$param=array(
"api_id" => $api_id,
"to" => $to,
"text" => $text,
"from" => $sender,
"partner_id" => 34316);
$ch = curl_init("http://sms.ru/sms/send");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
А вот как сделано в модуле СМС шлюз, но там другой СМС центер
<?php
// * @copyright OPENCART.PRO 2011 - 2015.
// * @forum http://forum.opencart.pro
// * @source See SOURCE.txt for source and other copyright.
// * @license GNU General Public License version 3; see LICENSE.txt
final class Smsc extends SmsGate {
public function send() {
return $this->_read_url('http://smsc.ru/sys/send.php?login='.urlencode($this->username).'&psw='.md5($this->password).
'&phones='.urlencode($this->to.($this->copy ? ','.$this->copy : '')).'&mes='.urlencode($this->message).
'&sender='.urlencode($this->from).'&cost=3&fmt=1&charset=utf8');
}
// Функция чтения URL. Для работы должно быть доступно:
// curl или fsockopen (только http) или включена опция allow_url_fopen для file_get_contents
private function _read_url($url)
{
$ret = "";
if (function_exists("curl_init"))
{
static $c = 0; // keepalive
if (!$c) {
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($c, CURLOPT_TIMEOUT, 10);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
}
curl_setopt($c, CURLOPT_URL, $url);
$ret = curl_exec($c);
}
elseif (function_exists("fsockopen") && strncmp($url, 'http:', 5) == 0) // not https
{
$m = parse_url($url);
$fp = fsockopen($m["host"], 80, $errno, $errstr, 10);
if ($fp) {
fwrite($fp, "GET $m[path]?$m[query] HTTP/1.1\r\nHost: smsc.ru\r\nUser-Agent: PHP\r\nConnection: Close\r\n\r\n");
while (!feof($fp))
$ret = fgets($fp, 1024);
fclose($fp);
}
}
else
$ret = file_get_contents($url);
return $ret;
}
}
?>
Вот универсальный класс.
Помогите переделать отправку под SMS.RU, всем нужно)) так как у SMS.ru бесплатная отправка смс для своего номера)