SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    grabbing to much!

    I'm having some difficulties with a script, this is the script:
    PHP Code:
    <?
    $fileArray 
    file("http://www.dft.nl/algemeen/24uuractueel.html");



    if ( ! 
    $fileArray ) {
       echo 
    '<tr><td>The news interface is down for maintenance.</td></tr>',
            
    '</table></body></html>';
       break;
    }   
    echo 
    '<table cellpadding=0 cellspacing=0><tr>';
    $searchStr ='<td class="time" nowrap="nowrap" valign="top"><a';
    $i 0;
    foreach(
    $fileArray AS $line) {
       if ( 
    strstr($line$searchStr) ) {
          

    $line str_replace("ShowNews.asp?""http://hfd.bvdep.com/ShowNews.asp?"$line );

          echo 
    $line"</tr><tr>\n"
          
    $i++;
       }
       if ( 
    $i == 10 ) {
          break;
       }



    ?>
    this is the output of the script:
    27-07-2001 22:39 Argentijnen halen massaal geld van de bank

    It is a headline of another site the script grabs.
    But, the script is grabbing to much, it searches for <td class="time" nowrap="nowrap , a string just before the time is beeing displayed. I do want the time on the site, but i want to drop the date, so everything before the searchstring shouldn't printed.

    Is there a way i can prevent the date from beeing printed, so the script only grabs the string and the rest of the sentence, but not whats on the same sentence of the site. Or better, grab from my selected point to a point i select?

    Dijksma

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think sscanf() is what you are after. I have not used it and don't know much about it:
    http://www.php.net/manual/en/function.sscanf.php


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
  •