2
<table width="100%" cellspacing="0" cellpadding="0" border="0" id="Table4">
  <tbody>
    <tr>
      <td valign="top" class="tx-strong-dgrey">
        <a class="anc-noul" href="http://www.example.com/catalog/proddetail.asp?logon=&amp;langid=EN&amp;sku_id=0665000FS10129471&amp;catid=25653">
          Apple 8GB 3rd Generation iPod Touch</a></td>
    </tr>
    <tr>
      <td valign="top" class="element-spacer"/>
    </tr>
    <tr>
      <td valign="top" class="tx-normal-grey">
        Product detail
        <a href="http://www.example.com/catalog/proddetail.asp?logon=&amp;langid=EN&amp;sku_id=0665000FS10129471&amp;catid=25653">
          More Info</a></td>
    </tr>
    <tr>
      <td valign="top" class="element-spacer"/>
    </tr>
    <tr>
      <td valign="top" class="tx-normal-red">
        <span class="tx-strong-dgrey">Price:</span>
        $189.99</td>
    </tr>
    <tr>
      <td valign="top">You save: $9.00 after instant savings</td>
    </tr>
    <tr>
      <td valign="top" class="element-spacer"/>
    </tr>
    <tr>
      <td valign="top" class="tx-normal-grey">
        <a href="http://www.example.com/catalog/subclass.asp?catid=25653&amp;logon=&amp;langid=EN">
          View similar products</a>  
        <a href="http://www.example.com/catalog/mfr.asp?man=Apple&amp;catid=19&amp;logon=&amp;langid=EN">
          View similar products with same brand</a>
      </td></tr>
    <tr>
      <td valign="top" class="element-spacer"/>
    </tr>
  </tbody>
</table>

I want to be able to get the $189.99.

echo $ret[0]->find('tr', 4)->plaintext;

This outputs: 'Price: $189.99'

I just need $189.99, not 'Price:'

6
  • What does vardump($ret[0]->find('tr', 4)) gives you? Commented Nov 23, 2009 at 17:45
  • Fatal error: Call to undefined function vardump() in C:\xampp\htdocs\... Commented Nov 23, 2009 at 17:47
  • 3
    var_dump() is what he meant Commented Nov 23, 2009 at 17:48
  • 1
    What object/library/function are you using to parse the DOM? (i.e., what's in $ret[0]?) Commented Nov 23, 2009 at 17:53
  • var_dump() outputs some kind of recursive unending txt { ["nodetype"]=> int(1) ["tag"]=> string(2) "tr" ["attr"]=> array(0) { } ["children"]=> array(1) { [0]=> object(simple_html_dom_node)#2591 (8) { ["nodetype"]=> int(1) ["tag"]=> string(2) "td" ["attr"]=> array(2) { ["valign"]=> string(3) "top" ["class"]=> string(14) "tx-normal-grey" } ["children"]=> array(1) { [0]=> object(simple_html_dom_node)#2592 (8) { ["nodetype"]=> int(1) ["tag"]=> string(4) "span" ["attr"]=> array(1) { ["class"]=> string(15) "tx-strong-dgrey" } ["children"]=> array(0) { } ["nodes"]=> array(1){.... Commented Nov 23, 2009 at 17:54

1 Answer 1

3
$exp = explode(":", $ret[0]->find('tr', 4)->plaintext);
$price =$exp[1];
Sign up to request clarification or add additional context in comments.

1 Comment

That does it. You guys are great.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.