Here's a waptrick/zamob music search script. I'm sure someone can make it better, please share back on upgrades/improvements MP3 search
PHP Code:
<?php
if(isset($_GET['buffer'])){
header('Content-Type:file; application/octet-stream; application/force-download');
header('Content-Disposition:attachment; filename='.basename($_GET['buffer']));
readfile('http://zamob.com/load-file'.$_GET['buffer']);
}
$page = isset($_GET['pageid']) ? abs((int)$_GET['pageid']) : 1;
echo <<<HEAD
<!DOCTYPE html>
<html>
<head><title>MP3 search</title>
<style type="text/css">
body{
color:#FFF;
background:#000;
margin:auto;
}
#logo{
background:#030;
text-align:left;
padding:5px;
}
a{
color:#FFFF00;
text-decoration:none;
font-weight:bold;
}
</style>
</head><body><div id="logo"><img src="{$_SERVER['HTTP_HOST']}" /></div>
<form action="?c" method="get">
Keyword: <br/><input class="search_sect" type="text" name="c" value=""/>
<input type="hidden" name="check" value="0"/>
<input class="submit" type="submit" value="Search" />
</form>
HEAD;
if(isset($_GET['c'])){
$url = 'http://zamob.com/_common/search/search.jsp';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url.'?c='.urlencode($_GET['c']).'&check=0&type=full_mp3&pageid='.$page);
curl_setopt($ch, CURLOPT_USERAGENT, 'BlackBerry');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
preg_match_all('/\/download\/(.*)">(.*)<\/a>/i', $data, $matches);
if(count($matches[1])){
for($x = 0; count($matches[1]) > $x; $x++) printf("<div>- <a href=\"?copy=%s\">%s</a></div>\n", $matches[1][$x], $matches[2][$x]);
}else echo '<br /><div style="color:#F00;font-weight:bold;">No results found for your search</div>';
preg_match_all('/" title="(.*)"/i', $data, $matches);
if(count($matches[1])){
echo '<div style="background:#202020;padding:5px;">';
for($x = 1; count($matches[1]) > $x; $x++){
$s = preg_replace('/&pageid=([0-9]+)/i', '', $_SERVER['QUERY_STRING']);
printf("<a href=\"?%s&pageid=%d\">%d</a> ", $s, $matches[1][$x], $matches[1][$x]);
}echo '</div>';
}
}
else if(isset($_GET['copy'])){
$url = 'http://zamob.com/download/'.str_replace('copy=', '', $_SERVER['QUERY_STRING']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, 'BlackBerry');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
preg_match_all('/load-file(.*)">(.*)<\/a>/i', $data, $matches);
if(count($matches[1])){
for($x = 0; count($matches[1]) > $x; $x++) printf("<div><a href=\"?buffer=%s\">%s</a></div>\n", $matches[1][$x], $matches[2][$x]);
}
}
echo <<<FOOT
</body>
</html>
FOOT;
?>
Comment