Skip to content

Instantly share code, notes, and snippets.

@oxpa
Last active October 21, 2016 08:11
Show Gist options
  • Save oxpa/f2abff74e037f1eac883 to your computer and use it in GitHub Desktop.
Save oxpa/f2abff74e037f1eac883 to your computer and use it in GitHub Desktop.
chatlogs parsing
<?php
date_default_timezone_set('UTC');
echo '<html>';
$request=explode('/',$_SERVER['SCRIPT_NAME'],3);
$log_url=$request[2];
if (empty($log_url)) {
$upper="programming@conference.jabber.ru/".date('o/m')."/";
$log_url="programming@conference.jabber.ru/".date('o/m/d').".html";
};
$log = @file_get_contents("http://chatlogs.jabber.ru/${log_url}");
if (empty($log)) {
header("Location: /programming@conference.jabber.ru/");
};
if (substr_count($log_url,"/")>2 && substr_count($log_url,"html")>0) {
if (empty($upper)) {$upper="./";}; echo '<a href="'.$upper.'"> ./</a><br/>';
preg_match_all('/<a href="(\S+(jpe?g|png|gif)\S*|https?:\/\/(imgur|img-9gag)\S+)"[^<]*<\/a>/i', $log, $urls);
foreach (array_unique($urls[0]) as $url) {
if (strpos($url, "legendaryusa.com")) continue ;
if (strpos($url, "jpeg.catfeed.net")) continue ;
echo $url."<br/>";
}
} else {
echo $log;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment