<?php

/*
    LjGrab: A php script to embed LiveJournal into your home page
    Version 0.1

    Copyright (C) Shanker Balan                    2002

    http://www.shankerbalan.com/
    Mailto: shanu at shankerbalan dot com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    Changelogs:

    
    Version 0.1
    - Wed Jul 24 16:32:13 IST 2002
    * Initial "this works" release

*/

require("common.php");
require(
"header.php");

// the journal URL
$url 'http://www.livejournal.com/users/shankerbalan/';

// Get the page using CURL
$ch curl_init($url);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
$tmp curl_exec ($ch);
curl_close ($ch);

// remove <html>..</head> aand then remove <body .. >
// from the bottom remove </body>..</html>
$search = array (
    
"'<html[^>]*?>.*?</head>'si",
    
"'<body .*?>'",
    
"'</body[^>]*?>.*?</html>'si"
    
);

$replace = array ( """""" );

$html preg_replace$search$replace$tmp );

echo 
$html;

require(
"footer.php");

?>