deleted unused and buggy method
This commit is contained in:
parent
522d7e4a2a
commit
bb8e309c07
@ -9,54 +9,6 @@ namespace ManiaControl;
|
||||
*/
|
||||
abstract class FileUtil {
|
||||
|
||||
/**
|
||||
* Load a remote file
|
||||
*
|
||||
* @param string $url
|
||||
* @return string || null
|
||||
*/
|
||||
public static function loadFile($url) {
|
||||
if (!$url) {
|
||||
return null;
|
||||
}
|
||||
$urlData = parse_url($url);
|
||||
$port = (isset($urlData['port']) ? $urlData['port'] : 80);
|
||||
|
||||
$fsock = fsockopen($urlData['host'], $port);
|
||||
stream_set_timeout($fsock, 3);
|
||||
|
||||
$query = 'GET ' . $urlData['path'] . ' HTTP/1.0' . PHP_EOL;
|
||||
$query .= 'Host: ' . $urlData['host'] . PHP_EOL;
|
||||
$query .= 'Content-Type: UTF-8' . PHP_EOL;
|
||||
$query .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . PHP_EOL;
|
||||
$query .= PHP_EOL;
|
||||
|
||||
fwrite($fsock, $query);
|
||||
|
||||
$buffer = '';
|
||||
$info = array('timed_out' => false);
|
||||
while (!feof($fsock) && !$info['timed_out']) {
|
||||
$buffer .= fread($fsock, 1024);
|
||||
$info = stream_get_meta_data($fsock);
|
||||
}
|
||||
fclose($fsock);
|
||||
|
||||
if ($info['timed_out'] || !$buffer) {
|
||||
return null;
|
||||
}
|
||||
if (substr($buffer, 9, 3) != "200") {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = explode("\r\n\r\n", $buffer, 2);
|
||||
|
||||
if (count($result) < 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load config xml-file
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user