如何使用param查找对象标签,并使用简单的html DOM php在HTML内嵌入标签 [英] How to find object tag with param, and embed tag inside HTML using simple html DOM php

查看:114
本文介绍了如何使用param查找对象标签,并使用简单的html DOM php在HTML内嵌入标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现真的很难理解php的简单html dom。即使我阅读了关于如何去做的说明。至于我,我只是编程界的新手。正如我一直在寻找如何找到对象标签和嵌入​​,我找不到正确的答案。所以在这里,我会发布我的问题,并希望得到正确的答案。 :)



我找不到这个对象: http://vodlocker.com/embed-gu09418zgs6y.html



这里是来自vodlocker的页面源代码的param对象标签。这是我想得到的。

 < object type =application / x-shockwave-flashdata = http://vodlocker.com/player/player.swfwidth =100%height =100%bgcolor =#000000id =flvplayername =flvplayertabindex =0__idm_id __ = 937985\" > 
< param name =allowfullscreenvalue =true>< param name =allowscriptaccessvalue =always>
< param name =seamlesstabbingvalue =true>
< param name =wmodevalue =opaque>< param name =flashvarsvalue =netstreambasepath = http%3A%2F%2Fvodlocker.com%2Fembed-gu09418zgs6y.html& amp; ID = flvplayer&放大器;放大器; FILE = HTTP%3A%2F%2F95.211.193.83%3A8777%2Fk6ceg4duoo4pcnokaktshz6a5e6vcg4hy7lzvwxjtd7dcwtb4o6vtdk5fe%2Fv.mp4&放大器;放大器;提供商= HTTP&放大器;放大器;图像= HTTP%3A%2F%2F95.211.193.83% 3A8777%2FI%2F02%2F00142%2Falirtn87xlws.jpg&放大器;放大器;皮肤= HTTP%3A%2F%2Fvodlocker.com%2Fplayer%2Fmodieus1.zip&放大器;放大器;持续时间= 12126&放大器;放大器;插件= timeslidertooltipplugin-3H%2Chttp%3A% 2F%2Flp.longtailvideo.com%2F5%2Fsharing%2Fsharing.swf&放大器;放大器;将allowFullScreen =总是&放大器;放大器; WMODE =不透明的放大器;放大器;将allowscriptaccess =总是&放大器;放大器;拉伸=均匀&放大器;放大器; abouttext = vodLocker&放大器;放大器; aboutlink = HTTP%3A%2F%2FvodLocker.com&放大器;放大器; timeslidertooltipplugin.preview =%5B%5BJSON%5D%5D%7B%22enabled%22%3Atrue%2C%22path%22%3A%22http%3A%2F%2F95.211.193 0.83%3A8777%2FI%2F02%2F00142%2F%22%2C%22prefix%22%3A%22alirtn87xlws%22%2C%22frequency%22%3A%22485%22%7D&放大器;放大器; timeslidertooltipplugin.pluginmode = HYBRID&放大器;放大器; sharing.sharing.link =&放大器;放大器; 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&放大器;放大器; sharing.link = HTTP%3A%2F%2Fvodlocker .COM%2Fgu09418zgs6y&放大器;放大器; 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&放大器;放大器; sharing.pluginmode = HYBRID&放大器;放大器; controlbar.position =以上&放大器;放大器; dock.position =左&放大器;放大器; logo.file = HTTP%3A%2F%2Fvodlocker.com%2Fimages%2Fvodjw_logo.png&放大器;放大器; logo.hide =假放大器;放大器; logo.timeout = 10&放大器;放大器; logo.over = 1&放大器;放大器; logo.out = 0.8&放大器;放大器; logo.position =右上&放大器;放大器; logo.lin K = HTTP%3A%2F%2FVodlocker.com>
< / object>

这是我的代码。这不起作用。我不知道为什么。也在包含嵌入的其他网站上。它也不起作用。

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


解决方案

两个问题,看起来像。首先,我相信你想要的是:

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

根据文档,这是如何找到< ; object> 标签。



你的第二个问题是,$ html不会返回任何代码, < object> 标签 - 您正在搜索的代码块不存在。



如果你要找的是 http://95.211.193.83:8777/k6ceg4duoo4pcnokaktshz6a5e6vcg4hy7lzvwxjtd7ddxdeooarqi7uci/v.mp4 < script> 标签中,所以试试:

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

然后遍历 $ b 返回,直到你得到你要找的东西。


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;

解决方案

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.

这篇关于如何使用param查找对象标签,并使用简单的html DOM php在HTML内嵌入标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆