Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP HTML DOM Parser Amazon offer listing pull all prices and seller names
    text
    copied!<p>I am trying to pull the price and seller from the amazon offer listing pages found at:</p> <p><a href="http://rads.stackoverflow.com/amzn/click/B002UYSHMM" rel="nofollow">http://www.amazon.com/gp/offer-listing/B002UYSHMM</a></p> <p>I can get the price by using:</p> <pre><code>$ret['Retail'] = $html-&gt;find('span[class="price"]', 0)-&gt;innertext; </code></pre> <p>This pulls the first price in the offer listing</p> <p>I tried to pull the matching seller of the first price by using the below to get the alt value from the img which contains the seller name:</p> <pre><code>$ret['SoldBy'] = $html-&gt;find('ul.sellerInformation img', 0)-&gt;getAttribute('alt'); </code></pre> <p>It worked for the first one but as I went down it started missing sellers and even missing prices in some cases.</p> <p>Can anyone tell why it would miss sellers and even jump around on prices? All I did to get additional sellers is:</p> <pre><code>$ret['Retail2'] = $html-&gt;find('span[class="price"]', 1)-&gt;innertext; $ret['SoldBy2'] = $html-&gt;find('ul.sellerInformation img', 1)-&gt;getAttribute('alt'); $ret['Retail3'] = $html-&gt;find('span[class="price"]', 2)-&gt;innertext; $ret['SoldBy3'] = $html-&gt;find('ul.sellerInformation img', 2)-&gt;getAttribute('alt'); $ret['Retail4'] = $html-&gt;find('span[class="price"]', 3)-&gt;innertext; $ret['SoldBy4'] = $html-&gt;find('ul.sellerInformation img', 3)-&gt;getAttribute('alt'); $ret['Retail5'] = $html-&gt;find('span[class="price"]', 4)-&gt;innertext; $ret['SoldBy5'] = $html-&gt;find('ul.sellerInformation img', 4)-&gt;getAttribute('alt'); $ret['Retail6'] = $html-&gt;find('span[class="price"]', 5)-&gt;innertext; $ret['SoldBy6'] = $html-&gt;find('ul.sellerInformation img', 5)-&gt;getAttribute('alt'); $ret['Retail7'] = $html-&gt;find('span[class="price"]', 6)-&gt;innertext; $ret['SoldBy7'] = $html-&gt;find('ul.sellerInformation img', 6)-&gt;getAttribute('alt'); </code></pre> <p>Thank you for any suggestions!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload