0

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]"; 
3
  • what is $html? what class etc. Commented Aug 24, 2013 at 19:09
  • you are not trying to generate and get a html code in the same PHP file right? Can you better explain $html class/object? Also: I'm not sure if you just omitted it, but did you close the div tag? Commented Aug 24, 2013 at 19:16
  • $html = file_get_html('nowrunning.com/movie/10811/tamil/thalaiva/4355/review.htm'); Commented Aug 24, 2013 at 19:18

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.