HTML Source Code:
<div id="ctl00_ContentPlaceHolder_Middle_RatingSummary1_Rating1_RatingPanel">
<img id="ctl00_ContentPlaceHolder_Middle_RatingSummary1_Rating1_RatingImage" title="(2.5 / 5) : Above Average" src="../../../../../images/net/common/stars/transparent/2.5.png" alt="(2.5 / 5) : Above Average" style="border-width:0px;" />
<span id="ctl00_ContentPlaceHolder_Middle_RatingSummary1_Rating1_RatingText" class="text med strong">(2.5 / 5) : Above Average</span>
<a id="ctl00_ContentPlaceHolder_Middle_RatingSummary1_Rating1_RatingHelp" class="help"></a>
I want Output like this:
(2.5 / 5) : Above Average
I tried it, but not Getting it:
Php code:
$ratings = $html->find('div[id=ctl00_ContentPlaceHolder_Middle_RatingSummary1_Rating1_RatingPanel] span')->outertext;
echo "$ratings[0]";
First of all, if you write
echo "something_here"
You'll get as output
something_here
even if something_here
is a variable. If you want to print a variable, don't put it inside ""
Now, instead of
$ratings = $html->find('div[id=...] span')->outertext;
echo "$ratings[0]";
Try doing
$ratings = $html->find('div[id=...] span');
echo $ratings[0]->outertext;
Besides, you probably want innertext
instead of outertext