SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    eregi help scraping some data

    I have worked out most of my data scraping needs but I can't seem to figure out a way to just the item number out of the following line of html.

    Code:
    <tr><td><a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;category=11576&amp;item=2817775050">2817775050</a></TD><TD bgcolor="#FFFFFF">Mar-11-03</TD><TD bgcolor="#FFFFFF">Aug-08-03 07:04:39 PDT</TD><TD bgcolor="#FFFFFF">$3.99</TD><TD bgcolor="#FFFFFF">KORET PETITES  Pink/White Spring Slacks  SM/P</TD><TD bgcolor="#FFFFFF"><a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;category=11576&amp;item=2817775050">Available</a></TD></TR>
    The part I want is just the number after item=

    Any help would be appreciated.
    Chrispian H. Burks
    Nothing To Say

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how about just
    PHP Code:
    $targ '<tr><td><a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;category=11576&amp;item=2817775050">2817775050</a></TD><TD bgcolor="#FFFFFF">Mar-11-03</TD><TD bgcolor="#FFFFFF">Aug-08-03 07:04:39 PDT</TD><TD bgcolor="#FFFFFF">$3.99</TD><TD bgcolor="#FFFFFF">KORET PETITES Pink/White Spring Slacks SM/P</TD><TD bgcolor="#FFFFFF"><a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;category=11576&amp;item=2817775050">Available</a></TD></TR>';
    preg_match('/item=([^"&]*)/'$targ$match);

    $item=$match[1];

    echo 
    $item
    ?
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #3
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    that rocks. I've still got a ways to go before I understand regex stuff. Very nice and worked exactly like I needed. Thank you!
    Chrispian H. Burks
    Nothing To Say


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •