简体   繁体   English

如何获取没有使用 PHP 指定的 class 或 id 的 span 标记的值

[英]How to get the value of a span tag with no class or id specified using PHP

I need help with my question.我的问题需要帮助。 How can I get the value of a span tag without class or id specified on it from a website.如何从网站获取没有指定 class 或 id 的 span 标签的值。

Example of it would be here:示例如下:

website: http://bit.ly/1C0IfkY网站: http : //bit.ly/1C0IfkY

Selected Source I only want to get选择的来源我只想得到

<p data-iceapc="3" data-iceapw="6"><span data-iceapw="2" style="font-size:25px; color:#98293D;">11am: 2-0-7 </span>

<span data-iceapw="2" style="font-size:25px; color:#98293D;">4pm: 7-2-3 </span>

<span data-iceapw="2" style="font-size:25px; color:#98293D;">9pm: _-_-_ </span></p>

I don't have any reference on finding the elements maybe someone can.我没有任何关于寻找元素的参考,也许有人可以。

$dom = new DOMDocument();
$dom->loadHTML($Url);
    $xpath = new DomXPath($dom);
$nodes = $xpath->query('//span[@style="font-size:25px; color:#98293D"]');
foreach ($nodes as $node) {
    echo  $node->nodeValue;

} }

These are the jQuery paths:这些是 jQuery 路径:

$("#content_box > article > div > p:nth-child(4) > span:nth-child(1)"); //value 1
$("#content_box > article > div > p:nth-child(4) > span:nth-child(3)"); // value 2
$("#content_box > article > div > p:nth-child(4) > span:nth-child(5)"); //value 3

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

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