close
判斷有效連結:
<?php
header("Content-Type:text/html; charset=utf-8");
$url="http://acd.idv.tw/w";
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);
/* Check for 404 (file not found). */
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 404) {
echo "連結錯誤!!";
}else{
echo "正確連結!!";
}
curl_close($handle); /* Handle $response here. */
?>
文章標籤
全站熱搜