Merhaba Arkadaşlar,

Paylaşım ve önerileriniz için teşekkür ederim.

Fakat Hiç Biri İşime Yaramadı. Sorunu Çözdüm inş. Burada paylaşmak Nasip olur..

--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 08:52:48 -->-> Daha önceki mesaj 08:51:52 --

EmreBulutlar adlı üyeden alıntı: mesajı görüntüle
file_exists()
fonksiyonu işinize yaramıyor mu?
AsiRuh adlı üyeden alıntı: mesajı görüntüle
<?php

$ch = curl_init("http://www.example.com/favicon.ico");
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $retcode;
?>
Bu kodları deneyin hocam eğer $retcode 200 çıkarsa o dosya var 404 çıkarsa dosya yok. Kolay gelsin.
saintx adlı üyeden alıntı: mesajı görüntüle
@bayraktar; sanırım böyle bi' şey istiyorsunuz?

<?php
	
	function curl_get_headers($url, $timeout = 20, $connect_timeout = 5, $follow_location = false, $max_redirs = 5)
	{
		if(extension_loaded("curl"))
		{
			$handle = curl_init();
			
			curl_setopt($handle, CURLOPT_URL, $url);
			
			curl_setopt($handle, CURLOPT_HEADER, true);
			curl_setopt($handle, CURLOPT_NOBODY, true);
			
			curl_setopt($handle, CURLOPT_VERBOSE, true);
			
			curl_setopt($handle, CURLOPT_BINARYTRANSFER, true);
			curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
			
			curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
			curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); 
			
			curl_setopt($handle, CURLOPT_TIMEOUT, $timeout);
			curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, $connect_timeout);
			
			if($follow_location)
			{
				curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
				curl_setopt($handle, CURLOPT_MAXREDIRS, $max_redirs);
			}
			
			$headers = curl_exec($handle);
			
			if(curl_errno($handle) !== 0)
			{
				return (object) array(
					"error" => (object) array(
						"no" => curl_errno($handle),
						"message" => curl_error($handle)
					)
				);
			}
			
			$headers = explode("\n", trim($headers, "\n"));
			
			$status = null;
			
			foreach($headers as $key => $value)
			{
				if($key > 0)
				{
					if(strlen(trim($value)) <= 0)
					{
						unset($headers[$key]);
					}
					else
					{
						$value = array_map("trim", explode(":", $value));
						
						$headers[str_replace("-", "_", strtolower($value[0]))] = $value[1];
						
						unset($headers[$key]);
					}
				}
				else
				{
					$_tmp = array();
					
					$status = $headers[$key];
					
					$status = explode(" ", $status);
					
					$_tmp["code"] = $status[1];
					$_tmp["protocol"] = $status[0];
					
					unset($status[0], $status[1]);
					
					$_tmp["message"] = implode(" ", $status);
					
					$status = $_tmp;
					
					ksort($status);
					
					unset($_tmp, $headers[$key]);
				}
			}
			
			curl_close($handle);
			
			ksort($headers);
			
			if(isset($headers["content_type"]))
			{
				$_tmp = array_map("trim", explode(";", $headers["content_type"]));
				
				if(isset($_tmp[1]))
				{
					$charset = explode("=", $_tmp[1]);
				}
				
				$content = array(
					"type" => $_tmp[0],
					"charset" => isset($charset) && isset($charset[1]) ? $charset[1] : null
				);
				
				unset($headers["content_type"], $_tmp);
			}
			
			if(isset($headers["content_length"]))
			{
				if(isset($content) == false)
				{
					$content = array();
				}
				
				$content["length"] = $headers["content_length"];
				
				unset($headers["content_length"]);
			}
			
			if(isset($content))
			{
				ksort($content);
			}
			
			unset($headers["status"], $handle, $url, $timeout, $connect_timeout);
			
			return json_decode(json_encode(array(
				"headers" => $headers,
				"content" => $content,
				"status" => $status
			)));
		}
		else
		{
			return false;
		}
	}
	
	function str_icontains($haystack, $needle)
	{
		return (bool) stripos($haystack, $needle) !== false;
	}
	
	function is_image($urls)
	{
		$response = array();
		
		foreach($urls as $url)
		{
			$request = curl_get_headers($url, 5);
			
			if(isset($request->error))
			{
				$response[] = (object) array("url" => $url, "status" => false);
			}
			else
			{
				$types = array(
					"jpg", "jpeg", "jpe", "gif", "png",
					"bmp", "tif", "tiff", "ico"
				);
				
				$is_finded = false;
				
				foreach($types as $type)
				{
					if(str_icontains($request->content->type, $type))
					{
						$is_finded = true;
						
						break;
					}
				}
				
				$response[] = (object) array("url" => $url, "status" => $is_finded);
			}
		}
		
		return $response;
	}
	
	$images = array(
		"https://www.r10.net/",
		"http://i.imgur.com/ZCRXIWB.gif",
		"http://saintx.net/"
	);
	
	$results = is_image($images);
	
	var_dump($results);
	
	/** ÇIKTI:
	
	array(3) {
	  [0]=>
	  object(stdClass)#5 (2) {
		["url"]=>
		string(19) "https://www.r10.net/"
		["status"]=>
		bool(false)
	  }
	  [1]=>
	  object(stdClass)#1 (2) {
		["url"]=>
		string(30) "http://i.imgur.com/ZCRXIWB.gif"
		["status"]=>
		bool(true)
	  }
	  [2]=>
	  object(stdClass)#6 (2) {
		["url"]=>
		string(18) "http://saintx.net/"
		["status"]=>
		bool(false)
	  }
	}
	
	**/
bayraktar adlı üyeden alıntı: mesajı görüntüle
Merhaba Arkadaşlar,

Paylaşım ve önerileriniz için teşekkür ederim.

Fakat Hiç Biri İşime Yaramadı. Sorunu Çözdüm inş. Burada paylaşmak Nasip olur..
Merhaba Arkadaşlar,

Paylaşım ve önerileriniz için teşekkür ederim.

Fakat Hiç Biri İşime Yaramadı. Sorunu Çözdüm inş. Burada paylaşmak Nasip olur..