Advertisement
cinos11

ARCbot API Bot Function IP and Port retreiver V1

Jun 29th, 2012
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2.     /*
  3.         V1: http://pastebin.com/iEx02e3h
  4.         Place this code in the functions list of the script
  5.     */
  6.     function getXatConnections($roomID) {
  7.         $apiUsername = 'USERNAME_HERE';
  8.         $apiToken = 'API_TOKEN_HERE';
  9.         $res = file_get_contents('https://arcbots.com/api-v2.html&tools=chatip&user='.$apiUsername.'&apiToken='.$apiToken.'&chatroom='.$roomID);
  10.         $data = json_decode($res,true);
  11.         if($data['errorCode'] == 3) {
  12.             $this->ip = $data['ip'];
  13.             $this->port = $data['port'];
  14.             return true;
  15.         }
  16.         return false;
  17.     }
  18.    
  19.     /*
  20.         How to use it:
  21.         $bot = new BasicXatBot();
  22.         $roomID = 88973610;
  23.         $bot->getXatConnections($roomID); // <<Place this line of code similarly around here
  24.         $bot->connect($bot->ip,$bot->port); // << Change default IP/Port connections into the scripts $bot-> variables
  25.         $bot->join($roomID);
  26.         while(true){
  27.             if($bot->read()=='DIED') {
  28.                 $bot->connect($bot->ip,$bot->port); // << Same as above, with the variables
  29.                 $bot->join($roomID);
  30.             }
  31.         }
  32.     */
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement