Last active
August 29, 2015 14:11
-
-
Save khiconit/63a214a9dda1374559f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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