如何通过simple_html_dom </script>获取<script>的内容

时间:2014-03-08 18:41:03

标签: simple-html-dom

我正在使用SIMPLE HTML DOM解析文本。 我阅读了文档,但没有找到如何获取内容。 我想从此脚本中获取此行/uploads/music/3/38/29_macho_skr-ft-a.l.a.m-repa-goydm.mp3。可能吗?任何帮助表示赞赏。

<script type="text/javascript" defer="defer">           
var flashvars = {};     
flashvars.skin = '/templates/topmusic/i/nobius_mk2/skin.xml';   
flashvars.playlistxml = '<track><location>/uploads/music/3/38/29_macho_skr-ft-a.l.a.m-repa-goydm.mp3</location><creator>Macho_SkR ft A.L.A.M 2014-New</creator><title>Repa Goydm Manhattan Prod.</title></track>';  
flashvars.autoplay = 'false';   
flashvars.volume    = '80';     
flashvars.shuffle = 'false';    
flashvars.repeat = 'true';  
flashvars.key = '9GXNDFPR9ZPG1EPA1JHV';     
flashvars.mousewheelfix = 'true';       
var params = {};            
var attributes = {};    
attributes.id = 'ep_player1';           
swfobject.embedSWF( '/engine/player/ep_player.swf');     
</script>

1 个答案:

答案 0 :(得分:0)

所以这就是答案:

foreach($html->find('.news_cont_pad script[defer="defer"]') as $element)
    {
            $linkkk = $element->innertext; 
            $link_e = explode('location', $linkkk);
            $aaaa=$link_e[1];
            $rest_r = substr($aaaa, 0, -2);  
            $rest_link = substr($rest_r, 1); 
            $rest_linkaa[] = 'http://xxx.xx'.$rest_link;
    }