guzzle 發起http請求與https請求的區別,發起https請求時,需要在構造函數中傳入一個配置項,
具體代碼如下:
//發起請求 $client = new Client(['timeout' => 5, 'verify' => false]); $response=$client->get($url,); $body = (string)$response->getBody(); $arr = json_decode($body, true);
這個配置項就是,'verify'=>false ,添加此配置項 即不檢查 ssl證書。