client = new Client([ 'base_uri' => C('TASK_URL'), 'timeout' => 10.0, ]); } protected function post($uri, $data) { $response = $this->client->post($uri, [ 'verify' => false, 'form_params' => $data ]); $result = (string)$response->getBody(); return json_decode($result, true); } public function sendSms($mobile, $type = 'common') { $result = $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type]); } public function checkSms($mobile, $code) { $result = $this->post('/message/sms-check', ['mobile' => $mobile, 'code' => $code]); } }