<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<?php
include "dom.php";
$nuo = 1; // nuo kelinto puslapio
$iki = 10; // iki kelinto puslapio
$url = "http://feelsound.lt/";
$data = file_get_html($url);
echo "Feelsound.lt dainu kopijavimas<br><form method='post'>";
echo '<select name="kat" id="kat">';
foreach($data->find('.submenu',0)->find('li a') as $list) {
echo $list->plaintext."<br>";
echo '
<option value="'.$list->href.'">'.$list->plaintext.'</option>';
}
echo "</select>";
echo '<table width="100" border="0">
<tr>
<td>Nuo:</td>
<td><input name="nuo" type="text" id="nuo" value="1" size="5" /></td>
<td>Iki:</td>
<td><input name="iki" type="text" id="iki" value="1" size="5" /></td>
</tr>
</table>';
echo "<input type='submit' name='data' value='OK'></form>";
if(isset($_POST['data'])) {
$pages = 0;
for ($page = $_POST['nuo']; $page <= $_POST['iki']; $page++) {
$kat = $_POST['kat'];
$url = "http://feelsound.lt".$kat."page/".$page."/";
//$data = gauti($url);
$datas = file_get_html($url);
foreach($datas->find('.entry') as $visosdainos) {
$daina['pavadinimas'] = $visosdainos->find('.full-link a font', 0)->plaintext;
$getid = explode("'",$visosdainos->find('.nauj',0)->getAttribute("onclick"));
$getid = $getid[1];
$info = $datas->find('#nauj-'.$getid,0);
$daina['kategorija'] = str_replace("/","",$_POST['kat']);
if($info->find('#mpl', 0)) {
$dainosfailas = current(explode("&volume",end(explode("&file=",$info->find('#mpl', 0)->getAttribute("flashvars")))));
$serverid = current(explode(".",end(explode("www",$dainosfailas))));
$fileid = str_replace("ay","",end(explode("Fkey%3D",$dainosfailas)));
$daina['server'] = $serverid;
$daina['file'] = $fileid;
$dainos[] = $daina;
}
}
$visos[] = $dainos;
}
// pavizdys
foreach ($visos as &$v) {
foreach ($v as &$d) {
echo "<strong>Pavadinimas:</strong> ".$d['pavadinimas']."<br>";
echo "<strong>Kategorija:</strong> ".$d['kategorija']."<br>";
echo "<strong>Serveris:</strong> ".$d['server']."<br>";
echo "<strong>Failas:</strong> ".$d['file']."<br>";
echo "<strong>Pilna URL:</strong> <a href='http://www".$d' target='_blank'><span style='color:005C5B'>http://www".$d</span></a>['server'].".zippyshare.com/v/".$d['file']."/file.html<br><br>";
}
}
// pavizdys end
}
?>