<?php
include 'simple_html_dom.php';
include 'conf.php';



$url = 'http://mp3.waprik.ru/lyrics/'.trim($_GET['q']).'/'.intval($_GET['w']).'';



$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url); 
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1');
curl_setopt($curl, CURLINFO_HEADER_OUT, FALSE);
curl_setopt($curl, CURLOPT_REFERER, 'http://mp3.waprik.ru/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
$res = curl_exec($curl);

$data = new simple_html_dom();
$data->load($res);
curl_close($curl);

include 'head.php';

if ($data == false)
	{
		echo 'Ошибка загрузки данных<br/>';
		include 'foot.php';
		exit;
	}

$tmp = $data->find('div[class="title"]', 0);
if ($tmp != false)
	{
		$p = $tmp->innertext;
		$p = str_replace('href="http://mp3.waprik.ru/', 'href="'.HOME.'', $p);
		echo '<div class="link2">'.$p.'</div>';
			
	}
	
$tmp = $data->find('div[class="block"]', 0);
if ($tmp != false)
	{
		$p = $tmp->innertext;
		$p = str_replace('href="http://mp3.waprik.ru/', 'href="'.HOME.'', $p);
		echo '<div class="link1">'.$p.'</div>';
			
	}
	
echo '<div class="link1"><a href="'.HOME.'">Вернуться к поиску</a></div>';

	
$data->clear();
unset($data);
include 'foot.php';
?>