SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Exeter, Devon, UK
    0 Post(s)
    0 Thread(s)

    Search/Replace in PHP. HELP!

    Hi there,
    I'm trying to make a script that'll pull the latest Top 10 videogames into a variabl (got that bit done) and then format to remove the extra gubbins.

    Basically, I'm trying to get a table with the top ten listed in it.

    My problem is, that the extra gubbins (reviews, add to basket etc) take up a good portion of the page. I need to pull the URL and Title of the item from the data that I have.

    I could do it if I could work out how to find a string that has TWO bits of unknown information in it.

    Each string will have a product code (ASIN) and game title. If it was just the ASIN that I needed, it would be no problem.

    The string is formatted like this:-

    <a href=><font face="verdana, arial, helvetica"><b>UNKNOWN GAME TITLE</b></font><br></a>
    How can I pull this string from a variable that is about 29k in size using PHP?

    Help appreciated!

  2. #2
    Are you ready for BSD? Marshall's Avatar
    Join Date
    Dec 2001
    0 Post(s)
    0 Thread(s)
    How can I pull this string from a variable that is about 29k in size using PHP?
    You'll either need to use the regular expression functions or write a custom parsing function. You'll probably find the latter option to be easier unless someone chimes in with the regexp solution. Since strings like "" will be consistent across all pages you should have no problem using the strpos() and substr() functions to locate and retrieve the values that you're interested in.

    - Marshall


Posting Permissions

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