app/Http/Controllers/MessageController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $user = "wish"; 
        $sender_id ="STKTRD"; 
        $msg = $request['message']; 
        $to=$request['number'];
        $key="C51B0623-05F1-419E-B192-1A80EF2E149F";
        $smstype="TextSMS";
         $route ="Transactional";
        $URL = 'http://sms.wishsolution.com/api/sms/SendSMS.aspx?'; 
        $ch = curl_init($URL);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');        
        curl_setopt($ch, CURLOPT_POSTFIELDS, "usr=$user&key=$key&to=$to&msg=$msg&rout=$route&smstype=$smstype&from=STKTRD");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
         curl_close($ch);
         $history = new Smsprice;
         $history->message =$request['message'];
         $history->user_type=$request['number'];
         $dt = Carbon::now();
            $newDate = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s',  $dt)
                ->format('d-m-Y'); 
          $history->date= $newDate; 
          $history->time =$dt->toTimeString();
          $history->save();
        return back()->with('success','Send SMS successfully');    
    }
public function store ( Request $ request ) { $ user = " wish " ; $ sender_id = " STKTRD " ; $ msg = $ request [ 'message' ] ; $ to = $ request [ 'number' ] ; $ key = " C51B0623-05F1-419E-B192-1A80EF2E149F " ; $ smstype = " TextSMS " ; $ route = " Transactional " ; $ URL = 'http://sms.wishsolution.com/api/sms/SendSMS.aspx?' ; $ ch = curl_init ( $ URL ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , 0 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , 0 ) ; curl_setopt ( $ ch , CURLOPT_POST , 1 ) ; curl_setopt ( $ ch , CURLOPT_ENCODING , 'UTF-8' ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , " usr= $ user &key= $ key &to= $ to &msg= $ msg &rout= $ route &smstype= $ smstype &from=STKTRD " ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; $ output = curl_exec ( $ ch ) ; curl_close ( $ ch ) ; $ history = new Smsprice ; $ history -> message = $ request [ 'message' ] ; $ history -> user_type = $ request [ 'number' ] ; $ dt = Carbon :: now ( ) ; $ newDate = \ Carbon \ Carbon :: createFromFormat ( 'Y-m-d H:i:s' , $ dt ) -> format ( 'd-m-Y' ) ; $ history -> date = $ newDate ; $ history -> time = $ dt -> toTimeString ( ) ; $ history -> save ( ) ; return back ( ) -> with ( 'success' , 'Send SMS successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// optional (compulsory in transactional sms)  // $api = "http://sms.wishsolution.com/api/sms/SendSMS.aspx?usr=wish&key=C51B0623-05F1-419E-B192-1A80EF2E149F&smstype=TextSMS&to=7503020572&msg=hi&rout=Transactional&from=STKTRD"  ;