https://github.com/econea/nusoap
* composer install
composer require econea/nusoap:~0.9.5.1
* .\app\Http\Controllers\SoapController.php
<?php
/**
* Created by PhpStorm.
* User: mingzhanghui
* Date: 9/11/2018
* Time: 6:17 PM
*/
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SoapController extends Controller {
/**
* http://localhost:8000/soap/sms?phoneNo=1300????562&content=easyeyes%20test%20of%20econea/nusoap
* @param Request $request
* @return int
* -7621671117161187846
*/
public function sms(Request $request) {
$phoneNo = $request->get('phoneNo');
$content = $request->get('content');
$parameter = array(
'userId' => '??????',
'password' => '??????',
'pszMobis' => $phoneNo,
'pszMsg' => $content,
'iMobiCount' => 1,
'pszSubPort' => '*',
'MsgId' => '???'
);
$smsService = new \nusoap_client('http://211.100.34.185:8016/MWGate/wmgw.asmx', false);
$smsService->soap_defencoding = 'utf-8';
$smsService->decode_utf8 = false;
$smsService->xml_encoding = 'utf-8';
$ret = $smsService->call('MongateSendSubmit', $parameter);
return $ret;
}
}
// ./routes/web.php
$router->get('soap/sms', 'SoapController@sms');