Web Site Adresine Erişim Kontrol Sınıfı

<?php
class adresTest{
	var $vektor = array();
	function __construct($time){
		set_time_limit($time);
	}
	function ekle($adres){
		$this->vektor[] = $adres;
	}
	function listele(){
		$list = $this->vektor;
		for($i = 0; $i < count($list);$i++){
			$this->test($list[$i]);
		}
	}
	function test($adres) {
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $adres);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		if(parse_url($adres, PHP_URL_SCHEME) == "https"){
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		}
		$cikti = curl_exec($ch);
		$bilgi = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		$hatalar = array("0","400", "401", "402", "403", "404", "405", "406", "407", "408", "409", "410", "411", "412", "413", "414", "415", "500", "501", "502", "503", "504", "505");
		if(in_array($bilgi, $hatalar)) {
			echo "<a href=\"".$adres."\" target=\"_blank\">".$adres."</a> <b>($bilgi) Sayfaya Erişilemiyor!</b><br />";
		}else{
			echo "<a href=\"".$adres."\" target=\"_blank\">".$adres."</a> <b>($bilgi) Geçerli Sayfa.</b><br />";
		}
		curl_close($ch);
	}
}
$test = new adresTest(0);
$test->ekle('http://www.google.com.tr');
$test->ekle('https://www.ulusanyazilim.com/feed');
$test->listele();
?>

Çıktısı

http://www.google.com.tr (200) Geçerli Sayfa.
https://www.ulusanyazilim.com/feed (301) Geçerli Sayfa.

 

Sizin Değerli Görüşlerinize İhtiyacımız Var.