Solved

Another preg_match_all regex question

Posted on 2010-11-17
20
326 Views
Last Modified: 2012-05-10
I'm using this to pull the number of bids on a sold auction

 $match_count3 = preg_match_all("'<div class=\"bin1\">(.*?)</div>'is",$source,$match3);

from a string like this

<td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$9.49</td>

But for some reason it is also picking up the number of bid here

<td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$74.99</td>

I need to grab the bid number of a sold item not everything, as a side note the sold item could also be from a "buy it now" or a "best offer" not sure if we can filter out the unsold items.
0
Comment
Question by:gamebits
  • 8
  • 6
  • 5
  • +1
20 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 34154894
Try this instead:
<div\s+class=\"bin1\">(\d+)\s+Bids</div><span\s+class=\"sold\">Sold

Open in new window

0
 
LVL 4

Assisted Solution

by:max-hb
max-hb earned 166 total points
ID: 34154904
Hi!
Tried your regex on the second string (<td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$74.99</td>) and it does NOT match anything. Maybe something is going wrong in your script logic?!
0
 
LVL 28

Author Comment

by:gamebits
ID: 34155139
@kaufmed

I'm running the script on 50 entries out of those 50 I should pull 16 sold items (either bids, buy it now or best offer) with my regex I'm pulling out 30 entries (picking up some I should not get) with your regex I'm picking up 10 (missing good entries) for instance the one with only 1 bid are not coming out.

@max-hb

That is why I'm asking for help because I cannot figure out why I'm pulling those 0 Bids entries with the regex I have.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34155253
This line does not make sense:

<td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$9.49</td>

That is the sort of thing you might put into an echo statement, but it would not have the backslash characters when it is rendered into HTML.  

Can you please post a link to the test data you are using?
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 167 total points
ID: 34155366
Sometimes REGEX does not really make sense because it gets complicated and takes a long time to debug.  When you have a fairly predictable string, it is often faster to write a little function to isolate the data elements into an associative array.
<?php // RAY_temp_gamebits.php

error_reporting(E_ALL);

echo "<pre>";



// TEST DATA COPIED FROM EE

$s = <<<S

<td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$9.49</td>

S;





function get_bid_results($s)

{

    // REMOVE THE BACKSLASHES - THEY DO NOT BELONG THERE

    $s = str_replace('\\', '', $s);



    // NORMALIZE THE DATA AND REMOVE THE TAGS

    $s = strip_tags(strtoupper($s));



    // ISOLATE THE DATA ELEMENTS

    $a = explode('BIDS',$s);

    $b = explode('$', $a[1]);



    // CONSTRUCT A RETURN ARRAY

    return array

    ( 'Bids'   => intval(trim($a[0]))

    , 'Status' => ucfirst(strtolower($b[0]))

    , 'Price'  => $b[1]

    )

    ;

}



$my_answers = get_bid_results($s);

var_dump($my_answers);

Open in new window

0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 34155637
>>  for instance the one with only 1 bid are not coming out.

That's probably because the string for 1 bid is "Bid" and not "Bids". We can make the "s" optional:
<div\s+class=\"bin1\">(\d+)\s+Bids?</div><span\s+class=\"sold\">Sold

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34155900
ID:34155637

Exactly the reason it is helpful to see the ACTUAL TEST DATA!  This should handle singular or plural 'Bid' but who knows what else might be involved?

Can you please post a link to the test data you are using?
<?php // RAY_temp_gamebits.php

error_reporting(E_ALL);

echo "<pre>";



// TEST DATA COPIED FROM EE

$s = <<<S

<td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$9.49</td>

S;





function get_bid_results($s)

{

    // REMOVE THE BACKSLASHES - THEY DO NOT BELONG THERE

    $s = str_replace('\\', '', $s);



    // NORMALIZE 'Bid' OR 'Bids'

    $s = str_replace('Bids', 'Bid', $s);



    // UPPERCASE DATA AND REMOVE THE TAGS

    $s = strip_tags(strtoupper($s));



    // ISOLATE THE DATA ELEMENTS

    $a = explode('BID',$s);

    $b = explode('$', $a[1]);



    // CONSTRUCT A RETURN ARRAY

    return array

    ( 'Bids'   => intval(trim($a[0]))

    , 'Status' => ucfirst(strtolower($b[0]))

    , 'Price'  => $b[1]

    )

    ;

}



$my_answers = get_bid_results($s);

var_dump($my_answers);

Open in new window

0
 
LVL 28

Author Comment

by:gamebits
ID: 34156071
Here is the data that I use, assign to the variable $source which explain why I have the backslash, I cut it down to the first 10 but it could be up to 200.

What I'm trying to do is extract the auction title, the number of bids, price sold and the date but only on sold item, sold item can be determined by number of bids (>0), buy it now or best offer, keep it mind though that having a buy it now button doesn't mean it sold.

here is the data sample


$source = "                                                                                                                                                                                                                                     <table class=\"li\" r=\"1\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/Wacky-Packages-Marshmallow-Flopp-PSA-9-/150521215308?pt=LH_DefaultDomain_0&amp;hash=item230bc3794c\" class=\"vip\">  Wacky Packages Marshmallow Flopp  PSA 9 </a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">150521215308</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=++Wacky+Packages+Marshmallow+Flopp++PSA+9+&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=150521215308&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=150521215308&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-42\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"150521215308\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$30.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 05:30</span></td></tr></tbody></table><a name=\"item2a0be5b8b5\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"2\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-TOPPS-BASEBALL-MICKEY-MANTLE-350-PSA-5-Ex-BV-600-/180588230837?pt=LH_DefaultDomain_0&amp;hash=item2a0be5b8b5\" class=\"vip\">1965 TOPPS BASEBALL MICKEY MANTLE #350-PSA 5(Ex)BV$600.</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180588230837</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+TOPPS+BASEBALL+MICKEY+MANTLE+%23350-PSA+5%28Ex%29BV%24600.&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180588230837&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180588230837&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-43\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180588230837\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">Buy It Now</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$162.75</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 02:42</span></td></tr></tbody></table><a name=\"item41546c2d8f\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"3\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1959-Topps-Don-Drysdale-PSA-Graded-NM-MT-8-/280589249935?pt=LH_DefaultDomain_0&amp;hash=item41546c2d8f\" class=\"vip\">1959 Topps Don Drysdale - PSA Graded NM-MT 8</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">280589249935</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1959+Topps+Don+Drysdale+-+PSA+Graded+NM-MT+8&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=280589249935&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=280589249935&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-44\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"280589249935\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$52.07</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 01:00</span></td></tr></tbody></table><a name=\"item2a0bbe432d\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"4\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1949-BOWMAN-BASEBALL-ALLIE-REYNOLDS-114-PSA-4-VG-EX-/180585644845?pt=LH_DefaultDomain_0&amp;hash=item2a0bbe432d\" class=\"vip\">1949 BOWMAN BASEBALL ALLIE REYNOLDS #114-PSA 4(VG-EX)</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180585644845</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1949+BOWMAN+BASEBALL+ALLIE+REYNOLDS+%23114-PSA+4%28VG-EX%29&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180585644845&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180585644845&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-45\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180585644845\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids bin1\">Buy It Now</td><td class=\"prc binsold g-b\">$26.04</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 23:46</span></td></tr></tbody></table><a name=\"item5add5e4507\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"5\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-LES-PSA-9-ONE-GRADED-HIGHER-/390260999431?pt=LH_DefaultDomain_0&amp;hash=item5add5e4507\" class=\"vip\">1965 UGLY STICKER #8 'LES' PSA 9 ONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260999431</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27LES%27+PSA+9+ONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260999431&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260999431&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-46\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260999431\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:59</span></td></tr></tbody></table><a name=\"item5add5e4232\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"6\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-VICTOR-PSA-9-NONE-GRADED-HIGHER-/390260998706?pt=LH_DefaultDomain_0&amp;hash=item5add5e4232\" class=\"vip\">1965 UGLY STICKER #8 'VICTOR' PSA 9 NONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260998706</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27VICTOR%27+PSA+9+NONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260998706&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260998706&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-47\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260998706\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:56</span></td></tr></tbody></table><a name=\"item255ecca051\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"7\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-MOVIE-32-PSA-7-NM-Ringo-Starr-very-clean-/160504258641?pt=LH_DefaultDomain_0&amp;hash=item255ecca051\" class=\"vip\">1964 BEATLES MOVIE #32 PSA-7(NM) Ringo Starr,very clean</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504258641</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+MOVIE+%2332+PSA-7%28NM%29+Ringo+Starr%2Cvery+clean&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504258641&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504258641&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-48\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504258641\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:40</span></td></tr></tbody></table><a name=\"item255ecc96dc\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"8\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-135-PSA-8-NM-MT-3rd-Series-J-Lennon-/160504256220?pt=LH_DefaultDomain_0&amp;hash=item255ecc96dc\" class=\"vip\">1964 BEATLES B&amp;W #135 PSA-8(NM-MT) 3rd Series J. Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504256220</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23135+PSA-8%28NM-MT%29+3rd+Series+J.+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504256220&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504256220&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-49\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504256220\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">4 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$11.10</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:35</span></td></tr></tbody></table><a name=\"item255ecc8fc7\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"9\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-116-PSA-7-NM-3rd-Series-John-Lennon-/160504254407?pt=LH_DefaultDomain_0&amp;hash=item255ecc8fc7\" class=\"vip\">1964 BEATLES B&amp;W #116 PSA-7(NM) 3rd Series John Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504254407</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23116+PSA-7%28NM%29+3rd+Series+John+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504254407&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504254407&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-50\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504254407\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.06</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:30</span></td></tr></tbody></table><a name=\"item1e5fa2a447\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"10\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1976-Topps-148-WALTER-PAYTON-ROOKIE-PSA-BVG-EXMT-/130453513287?pt=LH_DefaultDomain_0&amp;hash=item1e5fa2a447\" class=\"vip\">1976 Topps #148 WALTER PAYTON ROOKIE PSA BVG EXMT</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">130453513287</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1976+Topps+%23148+WALTER+PAYTON+ROOKIE+PSA+BVG+EXMT&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=130453513287&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=130453513287&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-51\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"130453513287\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$89.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:28</span></td></tr></tbody></table><a name=\"item2c58ca90cc\"> </a>";

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34156144
Uhh?

Maybe you can post the URL so we can read the data sample, thanks.
0
 
LVL 28

Author Comment

by:gamebits
ID: 34156150
Sorry didn't work, lets try this again.
<table class=\"li\" r=\"1\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/Wacky-Packages-Marshmallow-Flopp-PSA-9-/150521215308?pt=LH_DefaultDomain_0&amp;hash=item230bc3794c\" class=\"vip\">  Wacky Packages Marshmallow Flopp  PSA 9 </a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">150521215308</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=++Wacky+Packages+Marshmallow+Flopp++PSA+9+&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=150521215308&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=150521215308&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-42\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"150521215308\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$30.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 05:30</span></td></tr></tbody></table><a name=\"item2a0be5b8b5\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"2\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-TOPPS-BASEBALL-MICKEY-MANTLE-350-PSA-5-Ex-BV-600-/180588230837?pt=LH_DefaultDomain_0&amp;hash=item2a0be5b8b5\" class=\"vip\">1965 TOPPS BASEBALL MICKEY MANTLE #350-PSA 5(Ex)BV$600.</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180588230837</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+TOPPS+BASEBALL+MICKEY+MANTLE+%23350-PSA+5%28Ex%29BV%24600.&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180588230837&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180588230837&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-43\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180588230837\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">Buy It Now</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$162.75</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 02:42</span></td></tr></tbody></table><a name=\"item41546c2d8f\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"3\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1959-Topps-Don-Drysdale-PSA-Graded-NM-MT-8-/280589249935?pt=LH_DefaultDomain_0&amp;hash=item41546c2d8f\" class=\"vip\">1959 Topps Don Drysdale - PSA Graded NM-MT 8</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">280589249935</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1959+Topps+Don+Drysdale+-+PSA+Graded+NM-MT+8&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=280589249935&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=280589249935&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-44\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"280589249935\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$52.07</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 01:00</span></td></tr></tbody></table><a name=\"item2a0bbe432d\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"4\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1949-BOWMAN-BASEBALL-ALLIE-REYNOLDS-114-PSA-4-VG-EX-/180585644845?pt=LH_DefaultDomain_0&amp;hash=item2a0bbe432d\" class=\"vip\">1949 BOWMAN BASEBALL ALLIE REYNOLDS #114-PSA 4(VG-EX)</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180585644845</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1949+BOWMAN+BASEBALL+ALLIE+REYNOLDS+%23114-PSA+4%28VG-EX%29&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180585644845&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180585644845&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-45\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180585644845\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids bin1\">Buy It Now</td><td class=\"prc binsold g-b\">$26.04</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 23:46</span></td></tr></tbody></table><a name=\"item5add5e4507\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"5\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-LES-PSA-9-ONE-GRADED-HIGHER-/390260999431?pt=LH_DefaultDomain_0&amp;hash=item5add5e4507\" class=\"vip\">1965 UGLY STICKER #8 'LES' PSA 9 ONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260999431</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27LES%27+PSA+9+ONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260999431&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260999431&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-46\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260999431\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:59</span></td></tr></tbody></table><a name=\"item5add5e4232\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"6\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-VICTOR-PSA-9-NONE-GRADED-HIGHER-/390260998706?pt=LH_DefaultDomain_0&amp;hash=item5add5e4232\" class=\"vip\">1965 UGLY STICKER #8 'VICTOR' PSA 9 NONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260998706</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27VICTOR%27+PSA+9+NONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260998706&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260998706&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-47\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260998706\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:56</span></td></tr></tbody></table><a name=\"item255ecca051\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"7\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-MOVIE-32-PSA-7-NM-Ringo-Starr-very-clean-/160504258641?pt=LH_DefaultDomain_0&amp;hash=item255ecca051\" class=\"vip\">1964 BEATLES MOVIE #32 PSA-7(NM) Ringo Starr,very clean</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504258641</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+MOVIE+%2332+PSA-7%28NM%29+Ringo+Starr%2Cvery+clean&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504258641&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504258641&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-48\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504258641\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:40</span></td></tr></tbody></table><a name=\"item255ecc96dc\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"8\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-135-PSA-8-NM-MT-3rd-Series-J-Lennon-/160504256220?pt=LH_DefaultDomain_0&amp;hash=item255ecc96dc\" class=\"vip\">1964 BEATLES B&amp;W #135 PSA-8(NM-MT) 3rd Series J. Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504256220</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23135+PSA-8%28NM-MT%29+3rd+Series+J.+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504256220&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504256220&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-49\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504256220\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">4 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$11.10</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:35</span></td></tr></tbody></table><a name=\"item255ecc8fc7\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"9\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-116-PSA-7-NM-3rd-Series-John-Lennon-/160504254407?pt=LH_DefaultDomain_0&amp;hash=item255ecc8fc7\" class=\"vip\">1964 BEATLES B&amp;W #116 PSA-7(NM) 3rd Series John Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504254407</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23116+PSA-7%28NM%29+3rd+Series+John+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504254407&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504254407&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-50\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504254407\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.06</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:30</span></td></tr></tbody></table><a name=\"item1e5fa2a447\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"10\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1976-Topps-148-WALTER-PAYTON-ROOKIE-PSA-BVG-EXMT-/130453513287?pt=LH_DefaultDomain_0&amp;hash=item1e5fa2a447\" class=\"vip\">1976 Topps #148 WALTER PAYTON ROOKIE PSA BVG EXMT</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">130453513287</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1976+Topps+%23148+WALTER+PAYTON+ROOKIE+PSA+BVG+EXMT&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=130453513287&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=130453513287&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-51\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"130453513287\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$89.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:28</span></td></tr></tbody></table><a name=\"item2c58ca90cc\"> </a>

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 28

Author Comment

by:gamebits
ID: 34156181
Do a search on eBay for completed items and look at the source code.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34156279
What is the search URL?  This is the one I got:
http://shop.ebay.com/?_from=R40&_trksid=p5197.m570.l1313&_nkw=completed+items&_sacat=See-All-Categories

There are no backslash escape characters in the rendered HTML.
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 34156296
So what do you consider "the number of bids" for a "buy it now"?
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 34156391
Here is what I have for your latest sample. There will be no entry for number of bids for any item that is "buy it now".
<?php

	$source = "                                                                                                                                                                                                                                     <table class=\"li\" r=\"1\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/Wacky-Packages-Marshmallow-Flopp-PSA-9-/150521215308?pt=LH_DefaultDomain_0&amp;hash=item230bc3794c\" class=\"vip\">  Wacky Packages Marshmallow Flopp  PSA 9 </a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">150521215308</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=++Wacky+Packages+Marshmallow+Flopp++PSA+9+&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=150521215308&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=150521215308&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-42\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"150521215308\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$30.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 05:30</span></td></tr></tbody></table><a name=\"item2a0be5b8b5\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"2\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-TOPPS-BASEBALL-MICKEY-MANTLE-350-PSA-5-Ex-BV-600-/180588230837?pt=LH_DefaultDomain_0&amp;hash=item2a0be5b8b5\" class=\"vip\">1965 TOPPS BASEBALL MICKEY MANTLE #350-PSA 5(Ex)BV$600.</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180588230837</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+TOPPS+BASEBALL+MICKEY+MANTLE+%23350-PSA+5%28Ex%29BV%24600.&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180588230837&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180588230837&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-43\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180588230837\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">Buy It Now</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$162.75</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 02:42</span></td></tr></tbody></table><a name=\"item41546c2d8f\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"3\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1959-Topps-Don-Drysdale-PSA-Graded-NM-MT-8-/280589249935?pt=LH_DefaultDomain_0&amp;hash=item41546c2d8f\" class=\"vip\">1959 Topps Don Drysdale - PSA Graded NM-MT 8</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">280589249935</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1959+Topps+Don+Drysdale+-+PSA+Graded+NM-MT+8&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=280589249935&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=280589249935&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-44\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"280589249935\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$52.07</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 01:00</span></td></tr></tbody></table><a name=\"item2a0bbe432d\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"4\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1949-BOWMAN-BASEBALL-ALLIE-REYNOLDS-114-PSA-4-VG-EX-/180585644845?pt=LH_DefaultDomain_0&amp;hash=item2a0bbe432d\" class=\"vip\">1949 BOWMAN BASEBALL ALLIE REYNOLDS #114-PSA 4(VG-EX)</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180585644845</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1949+BOWMAN+BASEBALL+ALLIE+REYNOLDS+%23114-PSA+4%28VG-EX%29&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180585644845&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180585644845&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-45\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180585644845\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids bin1\">Buy It Now</td><td class=\"prc binsold g-b\">$26.04</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 23:46</span></td></tr></tbody></table><a name=\"item5add5e4507\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"5\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-LES-PSA-9-ONE-GRADED-HIGHER-/390260999431?pt=LH_DefaultDomain_0&amp;hash=item5add5e4507\" class=\"vip\">1965 UGLY STICKER #8 'LES' PSA 9 ONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260999431</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27LES%27+PSA+9+ONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260999431&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260999431&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-46\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260999431\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:59</span></td></tr></tbody></table><a name=\"item5add5e4232\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"6\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-VICTOR-PSA-9-NONE-GRADED-HIGHER-/390260998706?pt=LH_DefaultDomain_0&amp;hash=item5add5e4232\" class=\"vip\">1965 UGLY STICKER #8 'VICTOR' PSA 9 NONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260998706</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27VICTOR%27+PSA+9+NONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260998706&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260998706&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-47\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260998706\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:56</span></td></tr></tbody></table><a name=\"item255ecca051\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"7\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-MOVIE-32-PSA-7-NM-Ringo-Starr-very-clean-/160504258641?pt=LH_DefaultDomain_0&amp;hash=item255ecca051\" class=\"vip\">1964 BEATLES MOVIE #32 PSA-7(NM) Ringo Starr,very clean</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504258641</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+MOVIE+%2332+PSA-7%28NM%29+Ringo+Starr%2Cvery+clean&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504258641&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504258641&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-48\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504258641\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:40</span></td></tr></tbody></table><a name=\"item255ecc96dc\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"8\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-135-PSA-8-NM-MT-3rd-Series-J-Lennon-/160504256220?pt=LH_DefaultDomain_0&amp;hash=item255ecc96dc\" class=\"vip\">1964 BEATLES B&amp;W #135 PSA-8(NM-MT) 3rd Series J. Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504256220</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23135+PSA-8%28NM-MT%29+3rd+Series+J.+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504256220&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504256220&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-49\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504256220\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">4 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$11.10</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:35</span></td></tr></tbody></table><a name=\"item255ecc8fc7\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"9\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-116-PSA-7-NM-3rd-Series-John-Lennon-/160504254407?pt=LH_DefaultDomain_0&amp;hash=item255ecc8fc7\" class=\"vip\">1964 BEATLES B&amp;W #116 PSA-7(NM) 3rd Series John Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504254407</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23116+PSA-7%28NM%29+3rd+Series+John+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504254407&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504254407&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-50\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504254407\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.06</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:30</span></td></tr></tbody></table><a name=\"item1e5fa2a447\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"10\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1976-Topps-148-WALTER-PAYTON-ROOKIE-PSA-BVG-EXMT-/130453513287?pt=LH_DefaultDomain_0&amp;hash=item1e5fa2a447\" class=\"vip\">1976 Topps #148 WALTER PAYTON ROOKIE PSA BVG EXMT</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">130453513287</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1976+Topps+%23148+WALTER+PAYTON+ROOKIE+PSA+BVG+EXMT&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=130453513287&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=130453513287&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-51\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"130453513287\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$89.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:28</span></td></tr></tbody></table><a name=\"item2c58ca90cc\"> </a>";
	$match_count3 = preg_match_all("#<div\s+class=\"bin1\">(\d+)\s+Bids?|Buy It Now</div><span\s+class=\"sold\">Sold#is",$source,$match3,PREG_SET_ORDER);

	for ($i = 0; $i < count($match3); $i++)
	{
		$printme = $match3[$i][1];

		if (strlen($printme) == 0)
		{
			$printme = "Buy It Now";
		}

		print $printme . "<br />\n";
	}

	echo $source;
?>

Open in new window

untitled.PNG
0
 
LVL 28

Author Comment

by:gamebits
ID: 34156454
Try this url

http://completed.shop.ebay.com/Vintage-Pre-1980-/156521/i.html?LH_Complete=1&_trkparms=65%253A13%257C66%253A4%257C39%253A1&rt=nc&_nkw=psa&_ipg=25&_sop=10&_trksid=p3286.c0.m14.l1514

And there will be no backslash in the source code, I added the backslash latter on to assign the source code to a variable called $source which I can than use in my script
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34156676
See if this makes sense.  Moving parts start around line 400.
<?php // RAY_temp_gamebits.php

error_reporting(E_ALL);

echo "<pre>";



// TEST DATA COPIED FROM EE

$s = <<<S

<table class=\"li\" r=\"1\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/Wacky-Packages-Marshmallow-Flopp-PSA-9-/150521215308?pt=LH_DefaultDomain_0&amp;hash=item230bc3794c\" class=\"vip\">  Wacky Packages Marshmallow Flopp  PSA 9 </a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">150521215308</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=++Wacky+Packages+Marshmallow+Flopp++PSA+9+&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=150521215308&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=150521215308&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-42\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"150521215308\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

<img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\">

</td>

<td class=\"bids\">

<div class=\"bin1\">1 Bid</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$30.00</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-17 05:30</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item2a0be5b8b5\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"2\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1965-TOPPS-BASEBALL-MICKEY-MANTLE-350-PSA-5-Ex-BV-600-/180588230837?pt=LH_DefaultDomain_0&amp;hash=item2a0be5b8b5\" class=\"vip\">1965 TOPPS BASEBALL MICKEY MANTLE #350-PSA 5(Ex)BV$600.</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">180588230837</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1965+TOPPS+BASEBALL+MICKEY+MANTLE+%23350-PSA+5%28Ex%29BV%24600.&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180588230837&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180588230837&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-43\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180588230837\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids\">

<div class=\"bin1\">Buy It Now</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$162.75</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-17 02:42</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item41546c2d8f\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"3\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1959-Topps-Don-Drysdale-PSA-Graded-NM-MT-8-/280589249935?pt=LH_DefaultDomain_0&amp;hash=item41546c2d8f\" class=\"vip\">1959 Topps Don Drysdale - PSA Graded NM-MT 8</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">280589249935</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1959+Topps+Don+Drysdale+-+PSA+Graded+NM-MT+8&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=280589249935&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=280589249935&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-44\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"280589249935\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids\">

<div class=\"bin1\">2 Bids</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$52.07</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-17 01:00</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item2a0bbe432d\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"4\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1949-BOWMAN-BASEBALL-ALLIE-REYNOLDS-114-PSA-4-VG-EX-/180585644845?pt=LH_DefaultDomain_0&amp;hash=item2a0bbe432d\" class=\"vip\">1949 BOWMAN BASEBALL ALLIE REYNOLDS #114-PSA 4(VG-EX)</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">180585644845</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1949+BOWMAN+BASEBALL+ALLIE+REYNOLDS+%23114-PSA+4%28VG-EX%29&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180585644845&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180585644845&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-45\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180585644845\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids bin1\">Buy It Now</td>

<td class=\"prc binsold g-b\">$26.04</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 23:46</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item5add5e4507\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"5\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-LES-PSA-9-ONE-GRADED-HIGHER-/390260999431?pt=LH_DefaultDomain_0&amp;hash=item5add5e4507\" class=\"vip\">1965 UGLY STICKER #8 'LES' PSA 9 ONE GRADED HIGHER!</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">390260999431</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27LES%27+PSA+9+ONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260999431&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260999431&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-46\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260999431\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

<img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\">

</td>

<td class=\"bids bin1\">0 Bids</td>

<td class=\"prc binsold g-b\">$49.99</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 19:59</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item5add5e4232\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"6\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-VICTOR-PSA-9-NONE-GRADED-HIGHER-/390260998706?pt=LH_DefaultDomain_0&amp;hash=item5add5e4232\" class=\"vip\">1965 UGLY STICKER #8 'VICTOR' PSA 9 NONE GRADED HIGHER!</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">390260998706</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27VICTOR%27+PSA+9+NONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260998706&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260998706&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-47\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260998706\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

<img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\">

</td>

<td class=\"bids bin1\">0 Bids</td>

<td class=\"prc binsold g-b\">$49.99</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 19:56</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item255ecca051\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"7\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1964-BEATLES-MOVIE-32-PSA-7-NM-Ringo-Starr-very-clean-/160504258641?pt=LH_DefaultDomain_0&amp;hash=item255ecca051\" class=\"vip\">1964 BEATLES MOVIE #32 PSA-7(NM) Ringo Starr,very clean</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">160504258641</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+MOVIE+%2332+PSA-7%28NM%29+Ringo+Starr%2Cvery+clean&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504258641&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504258641&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-48\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504258641\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids\">

<div class=\"bin1\">2 Bids</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$6.00</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 19:40</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item255ecc96dc\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"8\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-135-PSA-8-NM-MT-3rd-Series-J-Lennon-/160504256220?pt=LH_DefaultDomain_0&amp;hash=item255ecc96dc\" class=\"vip\">1964 BEATLES B&amp;W #135 PSA-8(NM-MT) 3rd Series J. Lennon</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">160504256220</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23135+PSA-8%28NM-MT%29+3rd+Series+J.+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504256220&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504256220&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-49\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504256220\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids\">

<div class=\"bin1\">4 Bids</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$11.10</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 19:35</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item255ecc8fc7\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"9\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-116-PSA-7-NM-3rd-Series-John-Lennon-/160504254407?pt=LH_DefaultDomain_0&amp;hash=item255ecc8fc7\" class=\"vip\">1964 BEATLES B&amp;W #116 PSA-7(NM) 3rd Series John Lennon</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">160504254407</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23116+PSA-7%28NM%29+3rd+Series+John+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504254407&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504254407&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-50\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504254407\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids\">

<div class=\"bin1\">3 Bids</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$6.06</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 19:30</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item1e5fa2a447\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"10\">

<tbody>

<tr>

<td class=\"dtl lt\">

<div class=\"ttl\">

<a href=\"http://cgi.ebay.com/1976-Topps-148-WALTER-PAYTON-ROOKIE-PSA-BVG-EXMT-/130453513287?pt=LH_DefaultDomain_0&amp;hash=item1e5fa2a447\" class=\"vip\">1976 Topps #148 WALTER PAYTON ROOKIE PSA BVG EXMT</a>

</div>

<div class=\"dyn dynS\">

<div class=\"s1\">

<div class=\"mWSpc\">

</div>Item: <span class=\"v\">130453513287</span>

</div>

</div>

<div class=\"anchors\">

<div class=\"g-nav group\">

<a href=\"http://shop.ebay.com/sis.html?_kw=1976+Topps+%23148+WALTER+PAYTON+ROOKIE+PSA+BVG+EXMT&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=130453513287&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a>

<span class=\"vbar g-nav\">&nbsp;|&nbsp;</span>

<a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=130453513287&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a>

<div class=\"mi-l\">

<div>

<a class=\"pll ppr\" id=\"v4-51\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"130453513287\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a>

</div>

</div>

</div>

</div>

</td>

<td class=\"trs\">

</td>

<td class=\"bids\">

<div class=\"bin1\">1 Bid</div>

<span class=\"sold\">Sold</span>

</td>

<td class=\"prc bidsold g-b\">$89.99</td>

<td class=\"tme  rt\">

<b class=\"hidlb\">End Date:</b>

<span>Nov-16 19:28</span>

</td>

</tr>

</tbody>

</table>

<a name=\"item2c58ca90cc\"> </a>

S;



// REMOVE THE BACKSLASHES - THEY DO NOT BELONG THERE

$s = str_replace('\\', '', $s);





function get_bid_results($s)

{

    // NORMALIZE THE STRING

    $s = str_replace('Bids', 'Bid', $s);

    $s = strip_tags($s, '<td>');

    $s = preg_replace('/\s\s+/', ' ', $s);



    // BREAK INTO BITES

    $x = explode('<td class="bids">', $s);

    unset($x[0]);



    // ITERATE OVER THE BITES

    foreach ($x as $s)

    {

        $n = array();



        $s = strip_tags(strtoupper($s));

        $s = str_replace('BUY IT NOW', 'Buy It Now BID', $s);

        $a = explode('BID',$s);

        $n['Bids'] = trim($a[0]);

        $b = explode('$', $a[1]);

        $n['Status'] = ucfirst(strtolower(trim($b[0])));

        $n['Price']  = preg_replace('/[^0-9\.:]/', '', $b[1]);

        $n['Price']  = explode(':', $n['Price']);

        $n['Price']  = $n['Price'][0];

        $r[] = $n;

    }

    return $r;

}



$my_answers = get_bid_results($s);

print_r($my_answers);

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34156799
Wow - the test data just keeps changing.  In the future, please give us the ACTUAL test data the first time, so we don't waste time writing code that has to be re-written over and over.  Thanks.
0
 
LVL 74

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 167 total points
ID: 34156906
It's always a joy when I forget to use grouping around my OR operators  :D

Corrected:
<?php
	//$source = "                                                                                                                                                                                                                                     <table class=\"li\" r=\"1\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/Wacky-Packages-Marshmallow-Flopp-PSA-9-/150521215308?pt=LH_DefaultDomain_0&amp;hash=item230bc3794c\" class=\"vip\">  Wacky Packages Marshmallow Flopp  PSA 9 </a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">150521215308</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=++Wacky+Packages+Marshmallow+Flopp++PSA+9+&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=150521215308&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=150521215308&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-42\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"150521215308\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$30.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 05:30</span></td></tr></tbody></table><a name=\"item2a0be5b8b5\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"2\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-TOPPS-BASEBALL-MICKEY-MANTLE-350-PSA-5-Ex-BV-600-/180588230837?pt=LH_DefaultDomain_0&amp;hash=item2a0be5b8b5\" class=\"vip\">1965 TOPPS BASEBALL MICKEY MANTLE #350-PSA 5(Ex)BV$600.</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180588230837</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+TOPPS+BASEBALL+MICKEY+MANTLE+%23350-PSA+5%28Ex%29BV%24600.&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180588230837&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180588230837&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-43\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180588230837\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">Buy It Now</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$162.75</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 02:42</span></td></tr></tbody></table><a name=\"item41546c2d8f\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"3\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1959-Topps-Don-Drysdale-PSA-Graded-NM-MT-8-/280589249935?pt=LH_DefaultDomain_0&amp;hash=item41546c2d8f\" class=\"vip\">1959 Topps Don Drysdale - PSA Graded NM-MT 8</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">280589249935</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1959+Topps+Don+Drysdale+-+PSA+Graded+NM-MT+8&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=280589249935&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=280589249935&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-44\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"280589249935\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$52.07</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-17 01:00</span></td></tr></tbody></table><a name=\"item2a0bbe432d\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"4\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1949-BOWMAN-BASEBALL-ALLIE-REYNOLDS-114-PSA-4-VG-EX-/180585644845?pt=LH_DefaultDomain_0&amp;hash=item2a0bbe432d\" class=\"vip\">1949 BOWMAN BASEBALL ALLIE REYNOLDS #114-PSA 4(VG-EX)</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">180585644845</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1949+BOWMAN+BASEBALL+ALLIE+REYNOLDS+%23114-PSA+4%28VG-EX%29&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=180585644845&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=180585644845&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-45\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"180585644845\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids bin1\">Buy It Now</td><td class=\"prc binsold g-b\">$26.04</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 23:46</span></td></tr></tbody></table><a name=\"item5add5e4507\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"5\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-LES-PSA-9-ONE-GRADED-HIGHER-/390260999431?pt=LH_DefaultDomain_0&amp;hash=item5add5e4507\" class=\"vip\">1965 UGLY STICKER #8 'LES' PSA 9 ONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260999431</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27LES%27+PSA+9+ONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260999431&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260999431&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-46\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260999431\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:59</span></td></tr></tbody></table><a name=\"item5add5e4232\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"6\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1965-UGLY-STICKER-8-VICTOR-PSA-9-NONE-GRADED-HIGHER-/390260998706?pt=LH_DefaultDomain_0&amp;hash=item5add5e4232\" class=\"vip\">1965 UGLY STICKER #8 'VICTOR' PSA 9 NONE GRADED HIGHER!</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">390260998706</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1965+UGLY+STICKER+%238+%27VICTOR%27+PSA+9+NONE+GRADED+HIGHER%21&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=390260998706&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=390260998706&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-47\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"390260998706\",\"offset\":null,\"images\":1,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"><img src=\"http://p.ebaystatic.com/aw/pics/icons/iconTrsXSmall.gif\" alt=\"Get fast shipping and excellent service when you buy from eBay Top-rated sellers\" width=\"66\" height=\"30\"></td><td class=\"bids bin1\">0 Bids</td><td class=\"prc binsold g-b\">$49.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:56</span></td></tr></tbody></table><a name=\"item255ecca051\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"7\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-MOVIE-32-PSA-7-NM-Ringo-Starr-very-clean-/160504258641?pt=LH_DefaultDomain_0&amp;hash=item255ecca051\" class=\"vip\">1964 BEATLES MOVIE #32 PSA-7(NM) Ringo Starr,very clean</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504258641</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+MOVIE+%2332+PSA-7%28NM%29+Ringo+Starr%2Cvery+clean&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504258641&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504258641&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-48\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504258641\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">2 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.00</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:40</span></td></tr></tbody></table><a name=\"item255ecc96dc\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"8\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-135-PSA-8-NM-MT-3rd-Series-J-Lennon-/160504256220?pt=LH_DefaultDomain_0&amp;hash=item255ecc96dc\" class=\"vip\">1964 BEATLES B&amp;W #135 PSA-8(NM-MT) 3rd Series J. Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504256220</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23135+PSA-8%28NM-MT%29+3rd+Series+J.+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504256220&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504256220&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-49\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504256220\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">4 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$11.10</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:35</span></td></tr></tbody></table><a name=\"item255ecc8fc7\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"9\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1964-BEATLES-B-W-116-PSA-7-NM-3rd-Series-John-Lennon-/160504254407?pt=LH_DefaultDomain_0&amp;hash=item255ecc8fc7\" class=\"vip\">1964 BEATLES B&amp;W #116 PSA-7(NM) 3rd Series John Lennon</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">160504254407</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1964+BEATLES+B%26W+%23116+PSA-7%28NM%29+3rd+Series+John+Lennon&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=160504254407&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=160504254407&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-50\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"160504254407\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">3 Bids</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$6.06</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:30</span></td></tr></tbody></table><a name=\"item1e5fa2a447\"> </a>                                                                                                                                                                                                                                     <table class=\"li\" r=\"10\"><tbody><tr><td class=\"dtl lt\"><div class=\"ttl\"><a href=\"http://cgi.ebay.com/1976-Topps-148-WALTER-PAYTON-ROOKIE-PSA-BVG-EXMT-/130453513287?pt=LH_DefaultDomain_0&amp;hash=item1e5fa2a447\" class=\"vip\">1976 Topps #148 WALTER PAYTON ROOKIE PSA BVG EXMT</a></div><div class=\"dyn dynS\"><div class=\"s1\"><div class=\"mWSpc\"></div>Item: <span class=\"v\">130453513287</span></div></div><div class=\"anchors\"><div class=\"g-nav group\"><a href=\"http://shop.ebay.com/sis.html?_kw=1976+Topps+%23148+WALTER+PAYTON+ROOKIE+PSA+BVG+EXMT&amp;ssPageName=SRCH%3ACMPL%3AVS&amp;_fis=2&amp;_id=130453513287&amp;_isid=0&amp;_sibeleafcat=156521\">View similar active items</a><span class=\"vbar g-nav\">&nbsp;|&nbsp;</span><a href=\"http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&amp;item=130453513287&amp;ssPageName=STRK:MEWN:LILTX\">Sell one like this</a><div class=\"mi-l\"><div><a class=\"pll ppr\" id=\"v4-51\" href=\"javascript:;\" onmouseover='return gallery(event, {\"item\":\"130453513287\",\"offset\":null,\"images\":2,\"version\":0,\"href\":null});'>Enlarge</a></div></div></div></div></td><td class=\"trs\"></td><td class=\"bids\"><div class=\"bin1\">1 Bid</div><span class=\"sold\">Sold</span></td><td class=\"prc bidsold g-b\">$89.99</td><td class=\"tme  rt\"><b class=\"hidlb\">End Date:</b><span>Nov-16 19:28</span></td></tr></tbody></table><a name=\"item2c58ca90cc\"> </a>";
	$source = file_get_contents("test.html");
	$match_count3 = preg_match_all("#<div\s+class=\"bin1\">(?:(\d+)\s+Bids?|Buy It Now)</div><span\s+class=\"sold\">Sold#is",$source,$match3,PREG_SET_ORDER);

	for ($i = 0; $i < count($match3); $i++)
	{
		$printme = $match3[$i][1];

		if (strlen($printme) == 0)
		{
			$printme = "Buy It Now";
		}

		print $printme . "<br />\n";
	}

	echo $source;
?>

Open in new window

0
 
LVL 28

Author Closing Comment

by:gamebits
ID: 34222648
I understand that what I'm trying to do is not easy, and yes the data keeps changing that's why we are using regular expression isn't it?

Closing this question for now, will come back with other questions more specific.

Thanks.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34223160
The choice of REGEX or state engine has nothing to do with the changing test data.  The changing test data issue arose because the test data posted originally did not really resemble the ACTUAL working set data.

In computer science curricula one of the first things a programmer is taught are principles of TDD, and one of those principles is to have a robust set of test data at the "unit" level.  In other words, you perfect the inputs and expected outputs first, before you start trying to write code.  From my personal experience, I can tell you this is a really good way to get complicated programming done with great accuracy at a high rate of speed!
http://courses.cs.vt.edu/~cs1114/CreditByExam/TDD.pdf

Thanks for the points, and good luck with the project, ~Ray
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now