Skip to content

Instantly share code, notes, and snippets.

@khiconit
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khiconit/63a214a9dda1374559f9 to your computer and use it in GitHub Desktop.
Save khiconit/63a214a9dda1374559f9 to your computer and use it in GitHub Desktop.
<?php
function get_mp3($url) {
$arg = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $arg);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $arg);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_ENCODING, '');
$data = curl_exec($ch);
return $data;
}
$link ="http://mp3.zing.vn/";
//Xử lý tên bài hát
$mp3=get_mp3($link);
$name=explode('<a class="_link" title="Xem chủ đề Nhạc Hot Việt" href="',$mp3);
$name=explode('" >Nhạc Hot Việt</a></li>',$name[1]);
$newlink=get_mp3("http://mp3.zing.vn".$name[0]);
$newlink=explode('<a class="singer-img _trackLink" tracking="_frombox=chude_nhachotviet" title="',$newlink);
$newlink=explode('" href="',$newlink[1]);
echo $newlink[0];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment