Hirdetés
- Luck Dragon: Asszociációs játék. :)
- eBay-es kütyük kis pénzért
- sziku69: Fűzzük össze a szavakat :)
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- sziku69: Szólánc.
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- sh4d0w: Árnyékos sarok
- hcl: Poco F2 Pro facepalm
- Mr Dini: Mindent a StreamSharkról!
- urandom0: Száműztem az AI-t az életemből
Új hozzászólás Aktív témák
-
mm00
aktív tag
válasz
vakondka
#1528
üzenetére
fsockopen
function isOnline($url) {
if (!$url_info = parse_url($url)) {
return false;
}
switch ($url_info['scheme']) {
case 'https':
$scheme = 'ssl://';
$port = 443;
break;
case 'http':
default:
$scheme = '';
$port = 80;
}
$data = "";
$fid = @fsockopen($scheme . $url_info['host'], $port, $errno, $errstr, 30);
if ($fid) {
fputs($fid, 'HEAD ' . (isset($url_info['path'])? $url_info['path']: '/') . (isset($url_info['query'])? '?' . $url_info['query']: '') . " HTTP/1.0\r\n" .
"Connection: close\r\n" .
'Host: ' . $url_info['host'] . "\r\n\r\n");
while (!feof($fid)) {
$data .= @fgets($fid, 128);
}
fclose($fid);
return !empty($data);
} else {
return false;
}
}Curl:
function page_exists($url){
$parts=parse_url($url);
if(!$parts) return false; /* the URL was seriously wrong */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
/* set the user agent - might help, doesn't hurt */
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
/* try to follow redirects */
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
/* timeout after the specified number of seconds. assuming that this script runs
on a server, 20 seconds should be plenty of time to verify a valid URL. */
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
/* don't download the page, just the header (much faster in this case) */
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
/* handle HTTPS links */
if($parts['scheme']=='https'){
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
$response = curl_exec($ch);
curl_close($ch);
/* get the status code from HTTP headers */
if(preg_match('/HTTP\/1\.\d+\s+(\d+)/', $response, $matches)){
$code=intval($matches[1]);
} else {
return false;
};
/* see if code indicates success */
return (($code>=200) && ($code<400));
}
Új hozzászólás Aktív témák
- Logitech g25
- ZEBRA XPLORE iX125R1 12.5" ÜTÉS ÉS POR ÁLLÓ Windows TABLET ( i5-6200, 8G/256/LTE/GPS ) GARANCIÁVAL
- BESZÁMÍTÁS! ASUS B450 R5 2600X 8GB DDR4 250GB SSD 120GB SSD GTX 1050Ti 4GB Gamdias Argus E1 400W
- BESZÁMÍTÁS! ASUS B650M R7 8700F 32GB DDR5 1TB SSD RTX 4070 Super 12GB NZXT H510 Cougar 700W
- HP 250R G10 (A23MMEA) - 15,6" FullHD IPS - Intel 120U - 32GB DDR4 RAM - 512GB SSD - WIN11 - Garis
- Thermalright Phantom Spirit 120 SE
- Steam, EA, Ubisoft és GoG játékkulcsok, illetve Game Pass kedvező áron, egyenesen a kiadóktól!
- HIBÁTLAN iPhone 12 mini 64GB Red -1 ÉV GARANCIA - Kártyafüggetlen, MS2036
- ÁRGARANCIA!Épített KomPhone Ryzen 5 5600X 16/32/64GB RAM RX 7600 8GB GAMER PC termékbeszámítással
- ÚJ HP Victus 15 - 15.6" FHD IPS 144Hz - Ryzen 5 8645HS - 16GB - 512GB - RTX 4050 - Win11 - 3 év gari
Állásajánlatok
Cég: ATW Internet Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

