Created
May 21, 2009 15:09
-
-
Save mgng/115508 to your computer and use it in GitHub Desktop.
AAをランダムに表示するやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://taggedaa.com/ からランダムに何かを表示するやつ | |
// コマンドラインで実行 | |
// http://taggedaa.com/asciiart.php?id=92 | |
$baseUrl = 'http://taggedaa.com/asciiart.php?id='; | |
$num = rand(1,400); | |
$url = $baseUrl.$num; | |
$src = file_get_contents($url); | |
$reg = '/<pre[\s]*class=\"html\">(.+)<\/pre>/uis'; | |
preg_match($reg, $src, $m); | |
if (isset($m[1])) { | |
$str = str_replace( | |
array(' ', '<', '>', '&', ''', '"'), | |
array(' ','<', '>', '&', "'", '"'), | |
$m[1] | |
); | |
echo "########## {$num} ###########\n\n"; | |
echo mb_convert_encoding($str, 'SJIS-win', 'UTF-8'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment