Programming/PHP / / 2020. 4. 21. 16:56

해당 URL이 정상인지 체크

728x90
$url = "https://blog.naver.com/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
echo $info['http_code'] == 200 ? "정상" : "비정상";
반응형