简体   繁体   English

通过属性“名称”获取DomXPath值

[英]get DomXPath value by attribute “name”

I'm trying to get CIK codes from EDGAR . 我正在尝试从EDGAR获取CIK代码。 They don't give id s to their elements, but they at least give a name . 他们没有给元素赋予id ,但是至少给了name

In this case, when there's a result, the page will have a hidden with name="CIK" . 在这种情况下,如果有结果,该页面将被hidden ,其name="CIK"

I've got the page in a DOMDocument and that in a DomXPath . 我在DOMDocument有该页面,在DomXPath有该页面。 How do I get the value of that field? 我如何获得该领域的价值?

Many thanks in advance! 提前谢谢了!

Simple once you wind your way through the docs. 完成文档后就很简单。

$CIK = $finder->query("//hidden[@name='CIK']");

Oh, I wouldn't use that though. 哦,我不会用。 Their html is nothing but a mess and gave errors all over the place. 他们的html只是一团糟,到处都是错误。


Use this instead. 改用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM