Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function id_rand() {
- static $chars = '0123456789abcdefghijklmnopqrstuvwxyz_';
- $result = '';
- for ($i = 0; $i < 5; ++$i) {
- $result .= $chars[mt_rand(0, 36)];
- }
- return $result;
- }
- $fp = fopen('id.rtf', 'a');
- $ch = curl_init();
- curl_setopt_array($ch, [
- CURLOPT_SSL_VERIFYPEER => false,
- CURLOPT_RETURNTRANSFER => true,
- ]);
- $checked = [];
- while (true) {
- while (isset($checked[$id = id_rand()]));
- $checked[$id] = true;
- $url = "https://twitter.com/users/username_available?username={$id}";
- curl_setopt($ch, CURLOPT_URL, $url);
- $json = json_decode(curl_exec($ch), true);
- if (!isset($json['reason'])) {
- die('Decode error. Script has been shut down.');
- }
- echo "{$id} is {$json['reason']}\n";
- if ($json['reason'] === 'available') {
- fwrite($fp, "{$id}\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement