<?php
namespace gateways;

class rahpayam
{

    public static function rahpayam($apiKey, $mobile, $templateId, $params)
    {
        $params = [
            "mobile" => $mobile,
            "method" => "sms",
            "templateID" => $templateId,
            "params" => [
                $params,
            ]
        ];
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => 'https://api.msgway.com/send',
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POSTFIELDS => json_encode($params),
            CURLOPT_HTTPHEADER => array(
                'apiKey: ' . $apiKey,
            ),
        ));
        $response = curl_exec($curl);
        curl_close($curl);
        return $response;
    }

}
