file_get_contents get http code
$timeout=5; $send=array( 'k'=>'v' ); $opts=array( 'http'=>array( 'method'=>'POST', 'header'=>'Content-Type: application/json; charset=utf-8', 'content'=>json_encode($send), 'timeout'=>$timeout ) ); $context=stream_context_create($opts); $result=file_get_contents('https://example.com/url',false,$context); preg_match('/([0-9])\d+/',$http_response_header[0],$matches); $responsecode=intval($matches[0]); if($responsecode==200){ }