Monday, 2 September 2013

change xpath code to get correct info php curl

change xpath code to get correct info php curl

okay so i have a script that use the following source code
<h4>
<label id="ct0_l00_PageContainer_MyContainer_sym" for="symbol">
%
</label>59</h4>
my xpath code is
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$value =
$xpath->query('//label[@id="ct0_l00_PageContainer_MyContainer_sym"]/following-sibling::text()')->item(0)->nodeValue;
this query worked fine but after changing a few bits it no longer works i
have the new source code wich is below
<div id="ctl0_PageContainer_Container_divSummary">
<div class="blueheaderbar">
<h2>
Summary</h2>
</div>
<div class="usesummary">
<div class="ccbody">
<ul>
<li class="greybox">
<div class="boxOutlineW">
<span class="topLeft bg">
<!--for IE6-->
</span><span class="topRight bg">
<!--for IE6-->
</span><span class="bottomLeft bg">
<!--for IE6-->
</span><span class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<div class="pointbox">
<h3>
last 2 years</h3>
<div class="boxOutlineG
infoBoxwhite">
<span class="topLeft bg">
<!--for IE6-->
</span><span
class="topRight bg">
<!--for IE6-->
</span><span
class="bottomLeft bg">
<!--for IE6-->
</span><span
class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<h4>
98%</h4>
</div>
</div>
</div>
</div>
</div>
</li>
<li class="greybox">
<div class="boxOutlineW">
<span class="topLeft bg">
<!--for IE6-->
</span><span class="topRight bg">
<!--for IE6-->
</span><span class="bottomLeft bg">
<!--for IE6-->
</span><span class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<div class="pointsbox">
<h3>
You have used</h3>
<div class="boxOutlineG
infoBoxwhite">
<span class="topLeft bg">
<!--for IE6-->
</span><span
class="topRight bg">
<!--for IE6-->
</span><span
class="bottomLeft bg">
<!--for IE6-->
</span><span
class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<h4>
91%</h4>
</div>
</div>
</div>
</div>
</div>
</li>
<li class="greybox">
<div class="boxOutlineW">
<span class="topLeft bg">
<!--for IE6-->
</span><span class="topRight bg">
<!--for IE6-->
</span><span class="bottomLeft bg">
<!--for IE6-->
</span><span class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<div class="pointsbox">
<h3>
You still have </h3>
<div class="boxOutlineG
infoBoxwhite">
<span class="topLeft bg">
<!--for IE6-->
</span><span
class="topRight bg">
<!--for IE6-->
</span><span
class="bottomLeft bg">
<!--for IE6-->
</span><span
class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<h4>
7%</h4>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
if any one could help me i need to write a xpath for this part of the source
You still have </h3>
<div class="boxOutlineG
infoBoxwhite">
<span class="topLeft bg">
<!--for IE6-->
</span><span
class="topRight bg">
<!--for IE6-->
</span><span
class="bottomLeft bg">
<!--for IE6-->
</span><span
class="bottomRight bg">
<!--for IE6-->
</span>
<div class="content">
<h4>
7%</h4>
can anyone help me change this so it gets the correct value of 7%

No comments:

Post a Comment