<?php

namespace App\Services;

class sms
{
    public static function sendSMS($number, $message) {
        $url = 'https://console.melipayamak.com/api/send/simple/fc493d74babb4d299853dac6fdd2ae1d';
        $data = array('from' => '50002710008282', 'to' => "$number", 'text' => "$message");
        $data_string = json_encode($data);
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER,
            array('Content-Type: application/json',
                'Content-Length: ' . strlen($data_string))
        );
        $result = curl_exec($ch);
        return $result;
        curl_close($ch);
    }
}