简体   繁体   中英

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.

Example of it would be here:

website: 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:

$("#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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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