Hirdetés
- Poco F5 - pokolian jó ajánlat
- Samsung Galaxy S26 - szeret, nem szeret
- Google Pixel topik
- iPhone topik
- Apróbb változással jön a Pixel 11 az első képek szerint
- Telefonjavítás, szerviz
- Android alkalmazások - szoftver kibeszélő topik
- Képernyőmentes Fitbit jön a Google-től
- Így lehet kiszúrni, ha kamu AirPods fülest akarnak eladni neked
- Jolla és SailfishOS tapasztalatcsere
Ú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
- Dell Latitude 5420 14" Touchscreen i5-1135G7 16GB 256GB 1 év garancia
- Dell Latitude 5420 14" Touchscreen i5-1135G7 16GB 512GB 1 év garancia
- új NAGYakku!!! 6-10óra üzemidő, 5G! Dell Latitude 5330 i3-1215U - 16GB 256GB 13.3" FHD 1 év gar
- ZBook Fury 15 G7 15.6" FHD IPS i7-10850H RTX 3000 16GB 512GB NVMe magyar vbill gar
- Thinkpad X13 Gen5 13.3" FHD+ IPS Ultra 5 135U 16GB 512GB NVMe ujjlolv IR kam gar
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RTX 5080 16GB GAMER PC termékbeszámítással
- Sennheiser HD650 fejhallgató
- Decathlonos 43-as boxcipő, alig használt, hibátlan állapotban
- Alienware 500HZ AW2524HF 24,5" Monitor 27% ÁFÁS
- 233 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5080
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

