Advertisement
djazz

SGIP - extra.php - Uses the SGIP bot to get extra serverinfo

Apr 11th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2. // For SGIP:
  3. // http://djazz.mine.nu/apps/sgip/
  4.  
  5. header("content-type: text/plain");
  6. header("Access-Control-Allow-Origin: *");
  7. set_time_limit(3);
  8.  
  9. $ip = $_GET['ip'];
  10. $port = isset($_GET['port'])? intval($_GET['port']) : 10052;
  11. $password = isset($_GET['pswd'])? $_GET['pswd'] : '';
  12.  
  13. $result = array();
  14. $result['error'] = 0;
  15.  
  16. $tcp = @fsockopen("localhost", 8007, $errno, $errstr, 10);
  17. if(!$tcp) {
  18.     $result['error'] = 5;
  19.     echo json_encode($result);
  20.     exit;
  21. }
  22. fwrite($tcp, json_encode(array("ip" => $ip, "port" => $port, "password" => $password)));
  23. echo fread($tcp, 1024*1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement