$timeout ]; switch ($type) { case FormType::urlencoded: $params['form_params'] = $param; $type = 'POST'; break; case FormType::json: $params['json'] = $param; $type = 'POST'; break; case FormType::formData: $params['multipart'] = $param; $type = 'POST'; break; default: $params['query'] = $param; $type = 'GET'; break; } if ($extern) { $params = array_merge($params, $extern); } $r = $client->request($type, $url, $params); $res = $r->getBody()->getContents(); if ($isJson) { $data = json_decode($res, true); if ($data === false) { throw new Exception($res, 0); } } else { $data = $res; } return $data; } }