LiveJournal Crawling with PHP

A while back I was an LiveJournal junkie and spent most of my time reading peoples blog. It got lame pretty fast so i created a php script that retreived livejournal feeds for me.

Im sure this script wont work now since I created it a while back but maybe people can use it for something else?

So whts does the script do? Well it retreives Journals for X amount of users only if its been updated in the last 24 hours. It them Displays them nicely on one page. Please note that because program has to loop through X amount of journals, the page will take a while to load. If there is an error, try reloading the page.


########################################
## Armando Padilla - www.armando.ws
## Project: LiveJournal Retreival
## Status: No longer applicable.
## Design Change forces PHP to error.
## Better method would be to retreive XML
## from Live Journal(no access to it).
########################################
################### REPLACED WITH QUERY TO DB ##########################
$nicks = array("lilstar7", "lilguppy"); //array of users to look up
########################################################################
print(“”);

for($i=0; $i < count($nicks); $i++){

$web_site = fopen(“http://www.livejournal.com/userinfo.bml?user=”.$nicks[$i].”&mode=full”, “r”) or die (“Could not open LiveJournal for user”);

$web_site_info = fread($web_site, 100000000);

if(ereg(“1 day ago”, $web_site_info) || ereg(“Today”, $web_site_info)){

$journal = fopen(“http://www.livejournal.com/users/”.$nicks[$i].”/”, “r”) or die (“Could not open Users Journal”);
$journal_read = fread($journal, 100000000);

###########################
$from_text = “Music:”;
$to_text = “”;

$string = substr($journal_read,0,strpos($journal_read,$to_text));
$string = substr(strstr($string, $from_text), 0);

print(““.$nicks[$i].”
“); print(“$string

“);
fclose($journal);
}

fclose($web_site);
}
?>

Add a Comment

Your email address will not be published. Required fields are marked *