This tutorial explain how to extract MP3 songs from particular website. Nowadays it is a common and useful technique to extract data from another server. By this way you can extract useful data like meta tag details, html attribute/ tags details.
Check out our blog archive on the topic if you’re looking to learn about PHP CURL.
In case you want to learn more about link extraction technique using PHP CURL.
Lets see the source code to extract MP3 Links :
Here we have used file_get_contents() function to extract information from particular link.
Output :
http://itsmp3.in/download/63516/Dil_Diyan.mp3
http://itsmp3.in/download/63517/Dil_Diyan_HD.mp3
Check out another example to download MP3 Songs.
Check out our blog archive on the topic if you’re looking to learn about PHP CURL.
In case you want to learn more about link extraction technique using PHP CURL.
Lets see the source code to extract MP3 Links :
Here we have used file_get_contents() function to extract information from particular link.
<?php error_reporting(E_ERROR | E_PARSE); $URL = "http://itsmp3.in/mp3-download/Dil_Diyan_Gallan"; $str = file_get_contents($URL); $dom = new DOMDocument; $dom->loadHTML($str); foreach ($dom->getElementsByTagName('a') as $tag) { if(strpos($tag->getAttribute('href'),'.mp3')!==false) { echo $tag->getAttribute('href')."<br>"; } } ?>
Output :
http://itsmp3.in/download/63516/Dil_Diyan.mp3
http://itsmp3.in/download/63517/Dil_Diyan_HD.mp3
Check out another example to download MP3 Songs.
<?php // script to download mp3 songs $url = 'https://djworldking.in/upload_file/53/54/2+Many+Girls_(Ft.Badshah+Fazilpuria)_Dj+Jagat+Raj%20-%20(DjWorldKing.in).mp3' ; set_time_limit(0); //This is the file where we save the information $fp = fopen (dirname(__FILE__) . '/audio.mp3', 'w+'); //Here is the file we are downloading, replace spaces with %20 $ch = curl_init(str_replace(" ","%20",$url)); curl_setopt($ch, CURLOPT_TIMEOUT, 50); // write curl response to file curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // get curl response curl_exec($ch); curl_close($ch); fclose($fp); ?>
We do Digital work at very low price
ReplyDeletehttps://aimingsolution.com
Aiming
ReplyDelete