Re: Opening file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, April 26, 2007 2:19 pm, ed gregory wrote:
>
> Hi list,
>
> I have been trying to make "printer friendly version" feature for a
> web site and have encountered a problem. Each page of the web site is
> composed of a header.php, footer.php and the content of the page which
> uses "include_once" to include the above mentioned pages. I have tried
> all known methods of reading the file I want to have "printer friendly
> version" for, but all of them return a complete page (page with code
> of footer.php and header.php included, and not the original).
>
> So, here is what I get:
> ***********************
> <html>
> <title>aaa</title>
> <body>
> some content here
> </body>
> </html>
> ***********************
>
> And what I need is:
> ***********************
> <?
> include_once "header.php"
> ?>
> some content here
> <?
> include_once "footer.php"
> ?>
> ***********************
>
> After I get the original code I can exclude the "include" php tags and
> print only the main content.

<?php
  $html = file_get_contents("http://freenet.am";);
  preg_match("|<body[^>]>(.*)</body>|msi", $html, $body);
  echo htmlentities($body):
?>

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux