I am trying to pull only the alt value from the img tag using the simple php html dom parser. I cannot seem to get it to just pull the alt tag. Here is what I am using:
foreach($html->find('ul.sellerInformation img', 0) as $element) {
$ret['SoldBy'] = $element->alt;
}
It works and pulls the entire image tag if I use:
$ret['SoldBy'] = $html->find('ul.sellerInformation img', 0)->outertext;
But all I really want is the information in the alt tag.
I am trying to pull from html at the Amazon offer listing page at: http://www.amazon.com/gp/offer-listing/B001H8QHG0
Any suggestions?
Thanks for the help!
I’m assuming that you’re tying to get the value of the
altattribute here not thealttag.If so, you can use the
getAttributemethod.