Thanks that did the trick.

What I needed was to strip maybe the first paragraph 
of a article. The code you gave me would just strip
one line of code. But it gave me the pointer I needed
to find the final answer. I modified your code with 
other code I found in the manual and came up with the
solution. 

And here it is.....

<?php

   if ( $fp = fopen( "path/to/my/file/plus-the.file", "r" ) )
   {
      while( ! feof( $fp ) )
      {
         $line = fread ($fp, 800);

         if ( ! strpos( $line, "<P>" ) === false )
         {
            echo $line;
                break;
         }
      }

      fclose( $fp );
   }
?>
<A HREF= "path/to/my/file/plus-the.file"><FONT SIZE="2">...More</FONT></A>

This will display the first part of the article. Then the last part is if
you want to see the
rest of the article.


> ----------
> From:         Michael Rudel[SMTP:[EMAIL PROTECTED]]
> Reply To:     [EMAIL PROTECTED]
> Sent:         Saturday, March 10, 2001 12:42 AM
> To:   Mangiola Nunzio         Datavia; 'PHP Windows List (E-mail)'
> Subject:      RE: [PHP-WIN] Strip text from HTML
> 
> Hi Mangiola,
> 
> yes you can.
> 
> If the html-document is local on your server, you can "fopen"
> it an then parse line for line like this:
> 
> <?php
> 
>    if ( $fp = @fopen( "path/to/my/file/plus-the.file", "r" ) )
>    {
>       while( ! feof( $fp ) )
>       {
>          $line = fgets( $fp, 4096 );
> 
>          if ( ! strpos( $line, "<P>" ) === false )
>          {
>             echo $line;
>               break;
>          }
>       }
> 
>       fclose( $fp );
>    }
> ?>
> 
> ... And if it's on a remote Host, then do the same but with "fsockopen"
> (find help in the php-manual/Network Functions).
> 
> Hope t'll help.
> 
> Greetinx,
>   Mike
> 
> Michael Rudel
> - Web-Development, Systemadministration -
> _______________________________________________________________
> 
> Suchtreffer AG
> Bleicherstraße 20
> D-78467 Konstanz
> Germany
> fon: +49-(0)7531-89207-17
> fax: +49-(0)7531-89207-13
> e-mail: mailto:[EMAIL PROTECTED]
> internet: http://www.suchtreffer.de
> _______________________________________________________________
> 
> 
> 
> -----Original Message-----
> From: Mangiola Nunzio Datavia [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 09, 2001 2:01 PM
> To: PHP Windows List (E-mail)
> Subject: [PHP-WIN] Strip text from HTML
> 
> 
> Hi
> 
> I'd like to strip the first paragraph
> of a html document and display it.
> 
> basically the introduction and no more.
> 
> Is this possible?
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to