Hirdetés
- Mit várunk 2026-ban a mobilpiacon?
- Samsung Galaxy S25 - végre van kicsi!
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Rugalmas OLED panelre válthat a Samsung Galaxy A57
- iPhone topik
- Azonnali navigációs kérdések órája
- OnePlus 15 - van plusz energia
- Bemutatkozott a Poco X7 és X7 Pro
- Apple iPhone 17 Pro Max – fennsík
- Samsung Galaxy A56 - megbízható középszerűség
Új hozzászólás Aktív témák
-
fsockopen() függvénnyel:
(a függvények - kicsit átírva - a php.net-ről származnak)
<?php
/*
* A választ adja vissza fejlécek nélkül.
*/
function parseHttpResponse($content=null) {
if (empty($content)) { return false; }
// split into array, headers and content.
$hunks = explode("\r\n\r\n",trim($content));
if (!is_array($hunks) or count($hunks) < 2) {
return false;
}
$header = $hunks[count($hunks) - 2];
$body = $hunks[count($hunks) - 1];
$headers = explode("\r\n",$header);
unset($hunks);
unset($header);
if (!validateHttpResponse($headers)) { return false; }
if (in_array('Transfer-Encoding: chunked', $headers)) {
return trim(unchunkHttpResponse($body));
} else {
return trim($body);
}
}
/*
* Sikerült-e?
*/
function validateHttpResponse($headers=null) {
if (!is_array($headers) or count($headers) < 1) { return false; }
switch(trim(strtolower($headers[0]))) {
case 'http/1.0 100 ok':
case 'http/1.0 200 ok':
case 'http/1.1 100 ok':
case 'http/1.1 200 ok':
return true;
break;
}
return false;
}
/*
* ha darabolt az eredmény, akkor össze kell rakni, különben hülye számok és betűk jelennek meg a tartalomban
*/
function unchunkHttpResponse($str=null) {
if (!is_string($str) or strlen($str) < 1) { return false; }
$eol = "\r\n";
$add = strlen($eol);
$tmp = $str;
$str = '';
do {
$tmp = ltrim($tmp);
$pos = strpos($tmp, $eol);
if ($pos === false) { return false; }
$len = hexdec(substr($tmp,0,$pos));
if (!is_numeric($len) or $len < 0) { return false; }
$str .= substr($tmp, ($pos + $add), $len);
$tmp = substr($tmp, ($len + $pos + $add));
$check = trim($tmp);
} while(!empty($check));
unset($tmp);
return $str;
}
$host = "eu.wowarmory.com";
$file = "/guild-info.xml?r=Nordrassil&gn=Solidarity";
$user_agent_string = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1';
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp) {
die("$errstr ($errno)<br />\n");
} else {
$out = "GET $file HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "User-Agent: $user_agent_string \r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$content = '';
while (!feof($fp)) {
$content .= fgets($fp);
}
fclose($fp);
}
echo parseHttpResponse($content);
Új hozzászólás Aktív témák
- Liquid Freezer III 360 - használt, garancia: Alza 2031.02.16-ig - ALKUKÉPES.
- Asus Rog Strix G513 144hz Laptop Eladó!
- Mobil LTE hotspot router TP-Link M7200 V4 4G/LTE 150Mb/s,WiFi 2,4GHz 300M
- Four Connect Stage2 2x10mm2 prémium hangfalkábel Nakamichi banándugókkal
- ÚJ BONTATLAN MacBook Pro Air 13 - 16" Apple M1 M2 M3 M4 MAGYAR Billenyt AZONNAL DEÁK TÉRNÉL Átvehető
- Xiaomi 13T Dobozzal Töltővel
- Dell 14 Latitude 5430 FHD IPS i7-1255U vPro 4.7Ghz 10mag 16GB 256GB Intel Iris XE Win11 LTE Garancia
- Dell Latitude 5430 - i5-1245U, 16GB RAM, 512GB SSD, jó akku számla, garancia
- GYÖNYÖRŰ iPhone 12 mini 128GB Black -1 ÉV GARANCIA - Kártyafüggetlen, MS3878
- Acer TravelMate P214 i3-1115G4 12GB 256GB 14" FHD 1év garancia
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest


