Hirdetés
- sidi: 386-os Chicony gázplazma laptop memóriabővítése
- droidic: Windows 11 önállóság nélküli világ: a kontroll új korszaka
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Luck Dragon: Asszociációs játék. :)
- sziku69: Fűzzük össze a szavakat :)
- eBay-es kütyük kis pénzért
- Brogyi: CTEK akkumulátor töltő és másolatai
- ubyegon2: Airfryer XL XXL forrólevegős sütő gyakorlati tanácsok, ötletek, receptek
- Real Racing 3 - Freemium csoda
- GoodSpeed: Pillangóhatás: F billentyű meghibásodása -új gamer számítógépasztal
Ú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
- Battlefield 6
- Autós topik
- Goddess of Victory:Nikke
- Milyen alaplapot vegyek?
- exHWSW - Értünk mindenhez IS
- Házi barkács, gányolás, tákolás, megdöbbentő gépek!
- Poco F7 Pro - jó, de az amatőr sem rossz
- sidi: 386-os Chicony gázplazma laptop memóriabővítése
- Gumi és felni topik
- Arc Raiders
- További aktív témák...
- 153 - Lenovo LOQ (15IRX9) - Intel Core i5-13450HX, RTX 4060
- Telefon felvásárlás!! iPhone X/iPhone Xs/iPhone XR/iPhone Xs Max
- Intel Core i5 3470 confidential Ivy bridge Quad Core
- 0% THM 6 havi részlet beszámítás! RX 9060 XT / 9070 / 9070 XT videokártyák készletről KAMATMENTESEN
- Gamer PC-Számítógép! Csere-Beszámítás! R5 8400F / RX 6800 16GB / 32GB DDR5 / 1TB SSD
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Promenade Publishing House Kft.
Város: Budapest

