I am using a php bot script in my chat room. I have a command that I wish to alter. It’s a “define” command that searches the web for definitions. However, the results, at times, bring up some very inappropriate contents for some of the younger members of my chat group. This script is using urbandictionary.com as the site to retrieve this data, and I would like to change this site to dictionary.com (or any similar site), but I am unsure about how to code for this. Changing just the website link within the script does not solve this issue. I believe I need a line of code (or perhaps more) for the bot to recognize a change in script and retrieve data from a different website. Is there anyone who can help me with this. I would appreciate any help you can offer. Thanks.
Code for Current Define Command:
[php]case ‘!define’:
if(!$this->botOwner($this->packet[‘m’][‘u’])) {$this->sendMessage(“You’re not allowed to use this!”); return;}
if(trim($info[1])!=’’) {
$res = $this->get(‘http://www.urbandictionary.com/define.php?term=’.str_replace(’ ‘, ‘+’,$info[1]));
if(!($this->inStr(‘og:description’,$res))) $this->sendMessage(“No definition found.”);
else {
$resp = $this->getBetween($res, ‘<meta content=’’, ‘’’);
if(trim($resp)==’’) {$this->sendMessage(“No definition found.”); return;}
$this->sendMessage($resp);
if($this->inStr(’…’,$resp)) $this->sendMessage('http://www.urbandictionary.com/define.php?term=’.str_replace(’ ', ‘+’,$info[1]));
}
}
break;[/php]