We help IT Professionals succeed at work.

Extracting content from meta tag PHP MYHTML DOM

weekapaug
weekapaug asked
on
112 Views
Last Modified: 2017-03-10
There is a meta tag I need to isolate and extract data from and it looks like this.  The selector description has a colon in it and I'm not sure if this an issue or its just my syntax.  I tried to get around it with a wildcard search but it did nothing either.

<meta name="somefield:withColons" content="I need whats here in plain text">

Open in new window


I have tried a few things that I'm showing below but can not get the value to show up.  I get no errors either on some, just nothing but I know its there...

NOTHING BELOW HERE WORKS FOR ME
$myVar=$html->find("meta[name='somefield:withColons']")->content;
$myVar=$html->find(meta[name*=somefield)->content;
$myVar=$html->find("meta[name='somefield:withColons']")->plaintext;
$myVar=$html->find(meta[name*=somefield)->plaintextt;

Open in new window

Comment
Watch Question

Most Valuable Expert 2011
Author of the Year 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
You did it again Ray!! Thank you it was the line below that I was stuck on.  didnt know about the attr tag!

($meta_element->attr['content'])
Most Valuable Expert 2011
Author of the Year 2014

Commented:
Glad to help!