PHPでcurlを使ってHTTPSにアクセスする方法

phpコード:
$uri = “https://sample.com”;
$ch = curl_init ();
$data=I(‘post.’);
curl_setopt ( $ch, CURLOPT_URL, $uri );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
$return = curl_exec ( $ch );
dd($return);
curl_close ( $ch );

Comments are closed.