之前我已经完成了网络抓取,但它从未如此复杂。我想在iframe中获取参数值。
示例代码:
<iframe width="100%" scrolling="no" height="320px" frameborder="0" src="http://carriers.993low.com/fqoyJxxS.php">
<object id="player" width="100%" height="100%" type="application/x-shockwave-flash" data="http://merhad.333low.com/player.swf" bgcolor="#000000" name="player" tabindex="0">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="seamlesstabbing" value="true">
<param name="wmode" value="opaque">
<param name="flashvars" value="http://merhad.333low.com/fqoyJxxS-2c2MSx-wGYmS3T1pkggIeiK7wpA7BbXXcK2sC4XYWehpBDV6CAK7CFH/s=awcmxqt5gYntLqHJ9ceP.flv">
</object>
</iframe>
我想使用xpath返回对象内部的param的值。
答案 0 :(得分:0)
nodeValue不适用于属性。尝试:
$xpath2->query("//iframe/object/param[@name='flashvars']/@value")->item(0)->value;
或
$xpath2->query("//iframe/object/param[@name='flashvars']")->item(0)->getAttribute('value');