1

I need to exclude a

img
tag from

 <a href="http://www.facebook.com/xxxxxx">
     <img style="float: left; margin-right: 10px;" 
          src="http://profile.ak.fbcdn.net/xxxxx/xxxxx.jpg">
      Matt Cartledge
 </a>

and get only the text i.e. Matt Carledge. Is it possitble using php simple html dom parser? Thnk you.

$first_anchor = $list->find('a',0);
$prof_img = $first_anchor->find('img',0)->src;
echo $prof_name = $first_anchor->innertext;die();

i need prof_name to be "Matt Cartledge".

2
  • Should be. Show us what you've tried, and then we can help you go from there. Commented Jan 23, 2013 at 6:19
  • ok please view the edits. Commented Jan 23, 2013 at 6:25

1 Answer 1

3

Ah got it, its ->plaintext; thnk you

If we use like $something->innertext;(It gives everthing inside $something including all tags within it) AND if we use $something->plaintext;(It give only the texts exluding the tags).

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

2 Comments

Elaborate so that this could help future users.
oh.. if we use like $something->innertext;(It gives everthing inside $something including all tags within it) AND if we use $something->plaintext;(It give only the texts exluding the tags).

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.