Bittesehr:
PHP-Code:
<?php
function fix_nfo($text) {
$text = preg_replace('/<.?pre>/', '', $text);
$text = preg_replace('/>/', '>', $text);
$text = preg_replace('/<a.*title="(.*)".*a>/', '$1', $text);
return $text;
}
function fix_url($url) {
return preg_replace('/&/', '&', $url);
}
function get_info($release) {
$url = "https://www.xrel.to/search.html?mode=full&xrel_search_query=" . $release;
$headers = array();
$headers[] = "Host: www.xrel.to";
$headers[] = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0";
$headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$headers[] = "Accept-Language: en-US,en;q=0.5";
$headers[] = "Referer: " . $url;
$headers[] = "Cookie: ANON_LOCALE=de_DE; nfo_font=2; notice_understood=1";
$headers[] = "Dnt: 1";
$header = join ("\r\n", $headers);
$opts = array('http' =>
array(
'method' => 'GET',
'header' => $header,
)
);
$context = stream_context_create($opts);
$res = array();
$result = file_get_contents($url, false, $context);
preg_match('/<img src="(\/nfo-render.html.*)" alt=".*?NFO" usemap="#linkMap" \/>/ms', $result, $matches);
$res["img"] = fix_url('https://www.xrel.to/' . preg_replace('/.*(nfo-render.html[^"]*?)".*/', '$1', $matches[0]));
preg_match("/<pre>(.*?)<\/pre>/ms", $result, $matches);
$res["nfo"] = fix_nfo($matches[0]);
return $res;
}
$release = "Baby.Driver.2017.TS.XviD-TiTAN";
$release_info = get_info($release);
// img in $release_info["img"]
// nfo text in $release_info["nfo"]
echo var_dump($release_info);
?>