Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php class RocketSms { private $login; private $pass; function __construct($login, $pass) { $this->login = $login; $this->pass = $pass; } public function sendRocketSMS($phone, $message) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://api.rocketsms.by/json/send'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, "username=" . $this->login . "&password=" . $this->pass . "&phone=" . $phone . "&text=" . $message . "&priority=true"); $result = @json_decode(curl_exec($curl), true); return $result; } }
Copy Clear