Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- $kepek=array("jpg", "jpeg", "png", "webp", "gif");
- $konyvtar="./neko/";
- $dir=opendir($konyvtar);
- while($file=readdir($dir))
- {
- if(is_file($konyvtar.$file))
- {
- if(in_array(pathinfo($konyvtar.$file, PATHINFO_EXTENSION), $kepek))
- {
- $fajlok[]=$file;
- }
- }
- }
- $feltolt=fopen("lista.txt", "w");
- fwrite($feltolt, implode(PHP_EOL, $fajlok));
- fclose($feltolt);
- ?>
- <?PHP
- //API
- $lista=file("lista.txt");
- $x=mt_rand(0, count($lista)-1);
- echo '{"url": "http://www.domainnev.com/neko/'.urlencode(trim($lista[$x])).'"}';
- unset($lista);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement