Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo PHP_EOL . 'START' . PHP_EOL;
- $networks = file_get_contents('https://botbot.me/freenode/');
- preg_match_all('/<a href=".*">\#(.*)<\/a>/', $networks, $channels);
- foreach($channels[1] as $channel)
- {
- $channelData = file_get_contents('https://botbot.me/freenode/' . $channel . '/');
- preg_match_all('/<li class="month"><a class="jump-date" data-date=".*" href="\/freenode\/.*\/(.*)\/"><span>.*<\/span><\/a><\/li>/', $channelData, $dates);
- mkdir("output/$channel/", 755, true);
- foreach($dates[1] as $date)
- {
- mkdir("output/$channel/$date/", 755, true);
- $channelData = file_get_contents('https://botbot.me/freenode/' . $channel . '/' . $date . '/');
- preg_match_all('/<div class="message">(.*)<\/div>/', $channelData, $channelChatter);
- if(count($channelChatter[1]) > 0)
- {
- foreach($channelChatter[1] as $channelChat)
- {
- $channelChat = htmlspecialchars_decode(preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $channelChat));
- echo $channelChat . PHP_EOL . '####' . PHP_EOL;
- file_put_contents("output/$channel/$date/output.txt", $channelChat . "~##########~##########~", FILE_APPEND);
- }
- }
- }
- }
- echo PHP_EOL . 'END' . PHP_EOL;
Add Comment
Please, Sign In to add comment