Skip to content

Instantly share code, notes, and snippets.

@maskaravivek
Created March 23, 2014 16:57
Show Gist options
  • Save maskaravivek/9726027 to your computer and use it in GitHub Desktop.
Save maskaravivek/9726027 to your computer and use it in GitHub Desktop.
Code to scrap songs from bollywood jalwa and save it in a MYSQL database.
<?php
$album="Single Track";
$category="pop";
$letters=range('A', 'Z');
include('config.php');
include('simple_html_dom.php');
for($l=20;$l<26;$l++)
{
$ur="http://wap.bollywoodjalwa.com/home.php?dir=Ringtones/Mp3/MP3-Hollywood_Mp3/Hollywood-".$letters[$l]."&p=0&page=1&sort=1";
$htm= file_get_html($ur);
foreach($htm->find('.pagination') as $pag)
{
foreach($pag->find('a') as $p)
{
$last=$p->plaintext."<br/>";
}
}
echo $last;
for($k=0;$k<$last;$k++)
{
$url="http://wap.bollywoodjalwa.com/home.php?dir=Ringtones/Mp3/MP3-Hollywood_Mp3/Hollywood-".$letters[$l]."&p=0&page=".$k."&sort=1";
$html= file_get_html($url);
$i=0;
$arrayReplace=array("&nbsp;","&bull;","</b>","</span>");
foreach($html->find('table') as $block) {
foreach($block->find('a') as $ringtone)
{
$ringtone_link= $ringtone->href;
$name=ucwords(substr($ringtone->plaintext,0,strlen($ringtone->plaintext)-4));
$getLink=explode("&amp;",$ringtone_link);
$tone="http://wap.bollywoodjalwa.com/".substr($getLink[1],5);
}
mysql_query("INSERT INTO popup(name,singer,album,full_file_link,link,category) VALUES('$name','Unknown','$album','$tone','$tone','$category')");
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment