-
注释:Ixudra\Curl的安装请参考Ixudra\Curl官网
-
使用curl 发送post请求
$curl = \Curl::to($url)->to($url)
->asJsonRequest()
->withData([
'center_ip' => $center_ip,
'machine_code' => $hcode,
'action' => $action,
'node_uuid' => $nodeUuid
])
->withTimeout(60)
->asJsonResponse()
->returnResponseObject();
$res = $curl->post();
$certfile = 'client.crt';
$keyfile= 'client.key';
$curl = \Curl::to('https://'.$url)
->withOption('SSL_VERIFYHOST', false)
->withOption('SSLKEY', $keyfile)
->withOption('SSLCERT', $certfile);
$res = $curl->post();
return in_array($res->status, [200, 201, 204]);
网友评论