12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Http\Services;
- use GuzzleHttp\Client;
- class SendMessageService
- {
-
- public function sendMessage($mobile, $keyWold, $type = 1)
- {
- if ($type == 1) {
- $tpl = 'SMS_228115546';
- } elseif ($type == 2) {
- $tpl = 'SMS_228117817';
- } else {
- $tpl = 'SMS_228142587';
- }
- $url = 'http://translate.api.yinqingli.net/openapi/Msg/Msg';
- $data = [
- 'mobile' => $mobile,
- 'tpl' => $tpl,
- 'TemplateParam' => [
- 'keyword' => $keyWold,
- ],
- ];
- $client = new Client();
- $response = $client->post($url, [
- 'form_params' => $data,
- ]);
- $response->getBody()->getContents();
- }
- }
|