Link to home
Start Free TrialLog in
Avatar of weekapaug
weekapaug

asked on

Extracting content from meta tag PHP MYHTML DOM

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

ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of weekapaug
weekapaug

ASKER

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'])
Glad to help!