//抓取HTTPS重点设置'verify' => false
public function spiderInfo($cas){
$newCas = str_replace('-', '', $cas);
$url = "https://www.chem610.com/cas/". $newCas;
try{
$client = new Client(['timeout' => 5, 'verify' => false, 'headers'=>[
'user-agent'=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'
]]);
//GET方式
$response = $client->get($url);
//POST方式
/*
$response = $client->post($url,[
'form_params'=>[
'cas-search'=>$cas
],
'allow_redirects' => true
]);
*/
$html = $response->getBody();
}catch (Exception $e){
Log::info('searchCasException ', [$e]);
return false;
}
}