douxiong2001 2013-12-06 01:12
浏览 109
已采纳

如何使用param查找对象标记,并使用简单的html DOM php在HTML中嵌入标记

I found it really hard for me to understand the simple html dom of php. Even if I read the instruction on how to do it. As for me, I'm just new in programming industry. As I've been searching on how to find the object tag and embed, I can't find the right answer. So in here , I will post my problem and hoping for the right answer. :)

I can't find the object of this: http://vodlocker.com/embed-gu09418zgs6y.html

and here is the object tag with param from the page source of the vodlocker. and this is what i want to get.

<object type="application/x-shockwave-flash" data="http://vodlocker.com/player/player.swf" width="100%" height="100%" bgcolor="#000000" id="flvplayer" name="flvplayer" tabindex="0" __idm_id__="937985">
   <param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always">
   <param name="seamlesstabbing" value="true">
   <param name="wmode" value="opaque"><param name="flashvars" value="netstreambasepath=http%3A%2F%2Fvodlocker.com%2Fembed-gu09418zgs6y.html&amp;id=flvplayer&amp;file=http%3A%2F%2F95.211.193.83%3A8777%2Fk6ceg4duoo4pcnokaktshz6a5e6vcg4hy7lzvwxjtd7dcwtb4o6vtdk5fe%2Fv.mp4&amp;provider=http&amp;image=http%3A%2F%2F95.211.193.83%3A8777%2Fi%2F02%2F00142%2Falirtn87xlws.jpg&amp;skin=http%3A%2F%2Fvodlocker.com%2Fplayer%2Fmodieus1.zip&amp;duration=12126&amp;plugins=timeslidertooltipplugin-3h%2Chttp%3A%2F%2Flp.longtailvideo.com%2F5%2Fsharing%2Fsharing.swf&amp;allowfullscreen=always&amp;wmode=opaque&amp;allowscriptaccess=always&amp;stretching=uniform&amp;abouttext=vodLocker&amp;aboutlink=http%3A%2F%2FvodLocker.com&amp;timeslidertooltipplugin.preview=%5B%5BJSON%5D%5D%7B%22enabled%22%3Atrue%2C%22path%22%3A%22http%3A%2F%2F95.211.193.83%3A8777%2Fi%2F02%2F00142%2F%22%2C%22prefix%22%3A%22alirtn87xlws%22%2C%22frequency%22%3A%22485%22%7D&amp;timeslidertooltipplugin.pluginmode=HYBRID&amp;sharing.sharing.link=&amp;sharing.sharing.code=%253CIFRAME%2520SRC%253D%2522http%253A%252F%252Fvodlocker.com%252Fembed-gu09418zgs6y-720x400.html%2522%2520FRAMEBORDER%253D0%2520MARGINWIDTH%253D0%2520MARGINHEIGHT%253D0%2520SCROLLING%253DNO%2520WIDTH%253D720%2520HEIGHT%253D%253E%253C%252FIFRAME%253E&amp;sharing.link=http%3A%2F%2Fvodlocker.com%2Fgu09418zgs6y&amp;sharing.code=%253CIFRAME%2520SRC%253D%2522http%253A%252F%252Fvodlocker.com%252Fembed-gu09418zgs6y-640x360.html%2522%2520FRAMEBORDER%253D0%2520MARGINWIDTH%253D0%2520MARGINHEIGHT%253D0%2520SCROLLING%253DNO%2520WIDTH%253D640%2520HEIGHT%253D360%253E%253C%252FIFRAME%253E&amp;sharing.pluginmode=HYBRID&amp;controlbar.position=over&amp;dock.position=left&amp;logo.file=http%3A%2F%2Fvodlocker.com%2Fimages%2Fvodjw_logo.png&amp;logo.hide=false&amp;logo.timeout=10&amp;logo.over=1&amp;logo.out=0.8&amp;logo.position=top-right&amp;logo.link=http%3A%2F%2FVodlocker.com">
</object>

Here's my code. which is not working. i dont know why. also on other sites that contains embed. it is also not working.

include "include/simple_html_dom.php";
$a = "http://vodlocker.com/embed-gu09418zgs6y.html";
$html = file_get_html($a);
$b = $html->find('object')[0];
echo $b;
  • 写回答

2条回答 默认 最新

  • doulian4762 2013-12-06 01:43
    关注

    Two problems, it looks like. First off, I believe what you want is:

    $b = $html->find('object', 0);
    

    Per the docs, this is how to find the first instance of the <object> tag.

    Your second problem, though, is that the $html does not return any code with <object> tags - the code block you're searching for is not there.

    If what you're looking for is the http://95.211.193.83:8777/k6ceg4duoo4pcnokaktshz6a5e6vcg4hy7lzvwxjtd7ddxdeooarqi7uci/v.mp4 value, it's embedded in the <script> tags in the header, so try:

    $b = $html->find('script');
    

    Then loop through the array that $b returns until you get what you're looking for.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持