<?php
namespace gateways;

class MELLIPAYAMAKGateway{

    public static function sendSMS($username, $password, $mobile, $pattern , $input_data) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://rest.payamak-panel.com/api/SendSMS/BaseServiceNumber");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'username=' . $username . '&password=' . $password . '&to=' . $mobile . '&bodyId=' . $pattern . '&text=' . rawurlencode($input_data));   
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $server_output = curl_exec($ch);
        curl_close($ch);

        // 🟢 Return the response
        return $server_output;
    }


    public static function melipayamak($username, $password, $mobile, $bodyId, $code){
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"http://rest.payamak-panel.com/api/SendSMS/BaseServiceNumber");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password.'&to='.$mobile.'&bodyId='.$bodyId.'&text='.$code);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $server_output = curl_exec($ch);
        curl_close ($ch);

    }
}
