IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   PHP (https://www.ircforumlari.net/php/)
-   -   is_valid_url yine bir url kontrolü örneği (https://www.ircforumlari.net/php/635287-is_valid_url-yine-bir-url-kontrolu-ornegi.html)

hAte 30 Ekim 2014 07:31

is_valid_url yine bir url kontrolü örneği
 
PHP- Kodu:

<?php

function is_valid_url($url)
{
$url = [MENTION=45649]paRs[/MENTION]e_url($url);

if (!
$url)
{
return 
false;
}

$url array_map('trim'$url);
$url['port'] = (!isset($url['port'])) ? 80 : (int)$url['port'];
$path = (isset($url['path'])) ? $url['path'] : '';

if (
$path == '')
{
$path '/';
}

$path .= (isset($url['query'])) ? "?$url[query]'';

if (isset(
$url['host']) AND $url['host'] != gethostbyname($url['host']))
{
if (
PHP_VERSION >= 5)
{
$headers get_headers("$url[scheme]://$url[host]:$url[port]$path");
}
else
{
$fp fsockopen($url['host'], $url['port'], $errno$errstr30);

if (!
$fp)
{
return 
false;
}
fputs($fp"HEAD $path HTTP/1.1\r\nHost: $url[host]\r\n\r\n");
$headers fread($fp4096);
fclose($fp);
}
$headers = (is_array($headers)) ? implode("\n"$headers) : $headers;
return (bool)
preg_match('#^HTTP/.*\s+[(200|301|302)]+\s#i'$headers);
}
return 
false;
}

?>
<?php

if (is_valid_url('
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
style="color: #007700">))
{
do_something();
}

?>



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 19:04.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk