I\'m working on a script that echo\'s only the price. If I do:
$alttag = $oNode[\'p\'];
echo $alttag;
It will echo everything in <
So is this basically a web crawler for prices? I would suggest you look into using PHP's DOMDocument library to parse XML (Which XHTML practically is). You could then do something like:
//create a new DOMDocument object
$xmlDoc = new DOMDocument();
//load your html for parsing
$xmlDoc->loadHTML("Your HTML Code
");
//select the element that you want the attribute from...you may need to use $xmlDoc->getElementsByTagName('p');
$p_element = $xmlDoc->getElementById('yourtag');
//get the attribute alt of the selected element
$alt = $p_element->getAttribute('alt');
//show alt attribute value
echo $alt;
This is just pseudo code and will not solve your problem, however it seems to be a better solution than the parser you are trying to use. Look at these links for more information (I hope this helps):
http://www.php.net/manual/en/domdocument.construct.php
http://php.net/manual/en/domelement.getattribute.php
http://www.php.net/manual/en/domdocument.getelementsbytagname.php
http://www.php.net/manual/en/domdocument.getelementbyid.php