public static function soap_connect($command) { try { $soap = new SoapClient(NULL, array("location" => "http://" . Loader::load_config("soap_host") . ":" . Loader::load_config("soap_port"), "uri" => "urn:TC", "style" => SOAP_RPC, "login" => Loader::load_config("soap_user"), "password" => Loader::load_config("soap_pass"))); $soap->executeCommand(new SoapParam($command, "command")); return true; } catch (Exception $e) { return false; } }
public function ExecuteSoapCommand($command) { try { $cliente = new SoapClient(NULL, array("location" => $this->settings['syncapp_soap_ip'], "uri" => "urn:TC", "style" => SOAP_RPC, "login" => $this->settings['syncapp_soap_user'], "password" => $this->settings['syncapp_soap_password'])); $result = $cliente->executeCommand(new SoapParam($command, "command")); } catch (Exception $e) { return array('sent' => false, 'message' => $e->getMessage()); } return array('sent' => true, 'message' => $result); }
function sendSoap($command, $username, $password, $host, $soapport) { $client = new SoapClient(NULL, array("location" => "http://{$host}:{$soapport}/", "uri" => "urn:TC", "style" => SOAP_RPC, 'login' => $username, 'password' => $password)); try { $result = $client->executeCommand(new SoapParam($command, "command")); echo "Command succeeded! Output:<br />\n"; echo $result; } catch (Exception $e) { echo "Command failed! Reason:<br />\n"; echo $e->getMessage(); } }
/** * Send a console command * @param String $command * @return Array */ public function send($command) { $client = new SoapClient(NULL, array("location" => "http://" . $this->config['hostname'] . ":" . $this->config['console_port'], "uri" => "urn:TC", 'login' => $this->config['console_username'], 'password' => $this->config['console_password'])); try { $result = $client->executeCommand(new SoapParam($command, "command")); } catch (Exception $e) { die("Something went wrong! An administrator has been noticed and will send your order as soon as possible.<br /><br /><b>Error:</b> <br />" . $e->getMessage()); } }
* * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * MaNGOSsoap client example * * a simple example how to invoke commands using SOAP * * Make sure you enabled SOAP in your mangosd.conf! * SOAP.Enabled = 1 */ /* * $username and $password MUST be uppercase * account $username needs at least SEC_ADMINISTRATOR */ $username = '******'; $password = '******'; $host = "localhost"; $soapport = 7878; $command = "server info"; $client = new SoapClient(NULL, array("location" => "http://{$host}:{$soapport}/", "uri" => "urn:MaNGOS", "style" => SOAP_RPC, 'login' => $username, 'password' => $password)); try { $result = $client->executeCommand(new SoapParam($command, "command")); echo "Command succeeded! Output:<br />\n"; echo $result; } catch (Exception $e) { echo "Command failed! Reason:<br />\n"; echo $e->getMessage(); }
public function ExecuteSoapCommand($command, $realmid) { global $realms_config; try { $cliente = new SoapClient(NULL, array("location" => "" . $realms_config[$realmid]['soap_protocol'] . "://" . $realms_config[$realmid]['soap_address'] . ":" . $realms_config[$realmid]['soap_port'] . "/", "uri" => "urn:TC", "style" => SOAP_RPC, "login" => $realms_config[$realmid]['soap_user'], "password" => $realms_config[$realmid]['soap_pass'])); $result = $cliente->executeCommand(new SoapParam($command, "command")); } catch (Exception $e) { return array('sent' => false, 'message' => $e->getMessage()); } return array('sent' => true, 'message' => $result); }
function soap_command() { global $soapaddr, $soap_port, $soap_user, $soap_pass, $cmd, $char, $docmd; require_once 'scripts/config.php'; $cmd = $_GET['cmd']; $char = $_GET['char']; $id = $_GET['id']; $command = "error"; $client = new SoapClient(NULL, array('location' => "http://{$soapaddr}:{$soap_port}/", 'uri' => 'urn:TC', 'login' => $soap_user, 'password' => $soap_pass)); switch ($cmd) { case "rename": $command = "character rename {$char}"; break; case "changefaction": $command = "character changefaction {$char}"; break; case "changerace": $command = "character changerace {$char}"; break; case "cuztomize": $command = "character cuztomize {$char}"; break; default: $command = "error"; } if ($command != "error") { $docmd = $client->executeCommand(new SoapParam($command, "command")); } return $docmd; }
function chose_reward($reward) { global $lang, $core_rev, $remote_access, $DB, $MW, $project; $getourreward = $DB->select("SELECT `item_id`, `quanity`, `cost`, `quality`, `reward_text` FROM voting_rewards WHERE `id`=?d", $reward); foreach ($getourreward as $rewardvaluez) { $itemid = $rewardvaluez['item_id']; $qty = $rewardvaluez['quanity']; $cost = $rewardvaluez['cost']; $quality = $rewardvaluez['quality']; $rt = $rewardvaluez['reward_text']; $ch_rewards = array($itemid, $qty, $cost, $quality, $rt); } if ($_SESSION["points"] < $ch_rewards[2]) { echo "<center><font color='red'>Item could not be delivered because the system detects a hack. If you have reached this message in error, please\r\n\t\tcontact your Administrator.</font></center>"; exit; } $remote = $remote_access; if ((int) $MW->getConfig->vote_system->access_type == 1) { $sleeptimer = (int) $MW->getConfig->vote_system->sleep_timer; $telnet = @fsockopen($remote[0], $remote[1], $errno, $errstr, 5); if ($telnet) { fgets($telnet, 1024); // Motd if ($core_rev == 1) { fputs($telnet, "USER " . $remote[2] . "\n"); } else { fgets($telnet, 1024); // USER fputs($telnet, $remote[2] . "\n"); } if ($core_rev == 1) { fputs($telnet, "PASS " . $remote[3] . "\n"); } else { fgets($telnet, 1024); // PASS fputs($telnet, $remote[3] . "\n"); } sleep($sleeptimer); $remote_login = fgets($telnet, 1024); if ($remote_login[0] == "+") { if ($ch_rewards[0]) { fputs($telnet, "send items " . $_SESSION["char_name"] . " \"" . $lang["mail_subject"] . "\" \"" . $lang["mail_message"] . "\" " . $ch_rewards[0] . ":" . $ch_rewards[1] . "\n"); } else { fputs($telnet, "send money " . $_SESSION["char_name"] . " \"" . $lang["mail_subject"] . "\" \"" . $lang["mail_message"] . "\" " . $ch_rewards[1] . "\n"); } sleep($sleeptimer); $send_mail = fgets($telnet, 1024); if (strpos($send_mail, $_SESSION["char_name"])) { $DB->query("UPDATE `voting_points` SET `points`=(`points` - " . $ch_rewards[2] . "), `points_spent`=(`points_spent` + " . $ch_rewards[2] . ") \r\n\t\t\t\t\tWHERE `id` = " . $_SESSION["user_id"] . " LIMIT 1"); $_SESSION["points"] -= $ch_rewards[2]; $message = "<font color=\"blue\">" . $lang["was_given"] . " " . $ch_rewards[4] . " " . $lang["to"] . " " . $_SESSION["char_name"] . "</font>"; } else { $message = "<font color=\"red\">Send Mail Problem: " . $send_mail . "</font>"; } } else { $message = "<font color=\"red\">Remote Login Problem: " . $remote_login . "</font>"; } fclose($telnet); } else { $message = "<font color=\"red\">Telnet Connection Problem: " . $errstr . "</font>"; } echo "<center>" . $message . "<br /><br />Click <a href='index.php?n=community&sub=vote'>Here</a> To Return To The Vote System </center><br />"; exit; } else { // IF SOAP if ($ch_rewards[0]) { $command = "send items " . $_SESSION["char_name"] . " \"" . $lang["mail_subject"] . "\" \"" . $lang["mail_message"] . "\" " . $ch_rewards[0] . ":" . $ch_rewards[1]; } else { $command = "send money " . $_SESSION["char_name"] . " \"" . $lang["mail_subject"] . "\" \"" . $lang["mail_message"] . "\" " . $ch_rewards[1]; } if ($project == "mangos") { $client = new SoapClient(NULL, array("location" => "http://" . $remote[0] . ":" . $remote[1] . "/", "uri" => "urn:MaNGOS", "style" => SOAP_RPC, "login" => $remote[2], "password" => $remote[3])); } elseif ($project == "trinity") { $client = new SoapClient(NULL, array("location" => "http://" . $remote[0] . ":" . $remote[1] . "/", "uri" => "urn:TC", "style" => SOAP_RPC, "login" => $remote[2], "password" => $remote[3])); } try { $result = $client->executeCommand(new SoapParam($command, "command")); $DB->query("UPDATE `voting_points` SET `points`=(`points` - " . $ch_rewards[2] . "), `points_spent`=(`points_spent` + " . $ch_rewards[2] . ") \r\n\t\t\t\t\tWHERE `id` = " . $_SESSION["user_id"] . " LIMIT 1"); $_SESSION["points"] -= $ch_rewards[2]; $message = "<font color='blue'>" . $lang['was_given'] . " " . $ch_rewards[4] . " " . $lang["to"] . " " . $_SESSION["char_name"] . "</font>"; } catch (Exception $e) { $message = "<font color='darkred'>Send Mail Problem: " . $e->getMessage() . "</font>"; } echo $message . "<br />"; } }
public function mail_item_donation_ra($donate, $charid, $realmid) { global $MW, $lang, $project, $WSDB, $DB, $CHDB; // Now we set the variables and get the donation template // For debugging purposes, un-comment all the echo's $error_output = 0; $sleeptimer = (int) $MW->getConfig->vote_system->sleep_timer; //echo "Error Output Set...<br />"; $rid = $realmid; //echo "Recieved Realm ID Ok...<br />"; $donateid = $donate; //echo "Recieved Donate ID...<br />"; $guid = $charid; $char = $CHDB->selectCell("SELECT `name` FROM `characters` WHERE `guid`='{$guid}'"); //echo "Found Character " . $char . "...<br />"; $donation = $DB->select("SELECT `items`,`itemset`,`description`,`amount` FROM `donations_template` WHERE id='{$donateid}'"); foreach ($donation as $item) { $numb = $item['amount']; $itemid = $item['items']; $itemset = $item['itemset']; $descr = $item['description']; } //echo "Found Donation Template...<br />Amount: " . $numb . "<br />Item: " . $itemid . "<br />Itemset: " . $itemset . "<br />"; // Here we get the Remote Access information from the database for our current selected realm $getinfo = $DB->select("SELECT `ra_address`, `ra_port`, `ra_user`, `ra_pass` FROM `realmlist` WHERE `id`=?d", $rid); foreach ($getinfo as $rdinfo) { $a = $rdinfo['ra_address']; $pt = $rdinfo['ra_port']; $u = $rdinfo['ra_user']; $p = $rdinfo['ra_pass']; } $remote_access = array($a, $pt, $u, $p); //echo "Have Remote Access Array...<br />"; // For trinity, this shouldnt need to be changed if ($project == "mangos") { $find_rev = $DB->select("SELECT realmbuilds FROM realmlist WHERE id='{$rid}'"); if ($find_rev < 10506) { $core_rev = 1; } else { $core_rev = 0; } } elseif ($project == "trinity") { $core_rev = 1; } else { $core_rev = 1; } //echo "Using Core \"" . $project . "\" Scrpt Code...<br />"; // Here is the start of the remote access commands $remote = $remote_access; if ((int) $MW->getConfig->vote_system->access_type == 1) { $telnet = @fsockopen($remote[0], $remote[1], $errno, $errstr, 5); if ($telnet) { fgets($telnet, 1024); // Motd if ($core_rev == 1) { fputs($telnet, "USER " . $remote[2] . "\n"); } else { fgets($telnet, 1024); // USER fputs($telnet, $remote[2] . "\n"); } sleep($sleeptimer); if ($core_rev == 1) { fputs($telnet, "PASS " . $remote[3] . "\n"); } else { fgets($telnet, 1024); // PASS fputs($telnet, $remote[3] . "\n"); } sleep($sleeptimer); $remote_login = fgets($telnet, 1024); if ($remote_login[0] == "+") { echo "Sending Items...<br /><br />"; // If theres anything in the itemsets column, Run the command for each item if ($itemset != '') { $qray = $WSDB->select("SELECT entry FROM `item_template` WHERE itemset='" . $itemset . "'"); foreach ($qray as $d) { $items = $d['entry']; fputs($telnet, "send items " . $char . " \"" . $lang["mail_subject2"] . "\" \"" . $lang["mail_message2"] . "\" " . $items . ":" . $numb . "\n"); } // Or, If no itemset, but id is greater then 0 (Gold), Send the item. } elseif ($itemid > 0) { $itemz = explode(",", $itemid); foreach ($itemz as $mitemz) { $itemids = $mitemz; fputs($telnet, "send items " . $char . " \"" . $lang["mail_subject2"] . "\" \"" . $lang["mail_message2"] . "\" " . $itemids . ":" . $numb . "\n"); } } else { // If Item Is equal to 0, It must be gold. fputs($telnet, "send money " . $char . " \"" . $lang["mail_subject2"] . "\" \"" . $lang["mail_message2"] . "\" " . $numb . "\n"); } sleep($sleeptimer); $send_mail = fgets($telnet, 1024); if (strpos($send_mail, $char)) { $message = "<font color=\"blue\">" . $lang["was_given"] . " " . $descr . " " . $lang["to"] . " " . $char . "</font>"; } else { $message = "<font color=\"red\">Send Mail Problem: " . $send_mail . "</font>"; $error_output++; } } else { $message = "<font color=\"red\">Remote Login Problem: " . $remote_login . "</font>"; $error_output++; } fclose($telnet); } else { $message = "<font color=\"red\">Telnet Connection Problem: " . $errstr . "</font>"; $error_output++; } echo "<center>" . $message . "<br /><br />"; } else { // IF SOAP if ($project == "mangos") { $client = new SoapClient(NULL, array("location" => "http://" . $remote[0] . ":" . $remote[1] . "/", "uri" => "urn:MaNGOS", "style" => SOAP_RPC, "login" => $remote[2], "password" => $remote[3])); } elseif ($project == "trinity") { $client = new SoapClient(NULL, array("location" => "http://" . $remote[0] . ":" . $remote[1] . "/", "uri" => "urn:TC", "style" => SOAP_RPC, "login" => $remote[2], "password" => $remote[3])); } if ($itemset != '') { $qray = $WSDB->select("SELECT entry FROM `item_template` WHERE itemset='" . $itemset . "'"); foreach ($qray as $d) { $items = $d['entry']; $command = "send items " . $char . " \"" . $lang["mail_subject2"] . "\" \"" . $lang["mail_message2"] . "\" " . $items . ":" . $numb; try { $result = $client->executeCommand(new SoapParam($command, "command")); $message = "<font color='blue'>" . $lang['was_given'] . " " . $items . " " . $lang["to"] . " " . $char . "</font>"; } catch (Exception $e) { $message = "<font color='darkred'>Send Mail Problem: " . $e->getMessage() . "</font>"; $error_output++; } echo $message . "<br />"; } } elseif ($itemid > 0) { $itemz = explode(",", $itemid); foreach ($itemz as $mitemz) { $itemids = $mitemz; $command = "send items " . $char . " \"" . $lang["mail_subject2"] . "\" \"" . $lang["mail_message2"] . "\" " . $itemids . ":" . $numb; try { $result = $client->executeCommand(new SoapParam($command, "command")); $message = "<font color='blue'>" . $lang['was_given'] . " " . $itemids . " " . $lang["to"] . " " . $char . "</font>"; } catch (Exception $e) { $message = "<font color='darkred'>Send Mail Problem: " . $e->getMessage() . "</font>"; $error_output++; } echo $message . "<br />"; } } else { $command = "send money " . $char . " \"" . $lang["mail_subject2"] . "\" \"" . $lang["mail_message2"] . "\" " . $numb; try { $result = $client->executeCommand(new SoapParam($command, "command")); $message = "<font color='blue'>" . $lang['was_given'] . " " . $numb . " Gold " . $lang["to"] . " " . $char . "</font>"; } catch (Exception $e) { $message = "<font color='darkred'>Send Mail Problem: " . $e->getMessage() . "</font>"; $error_output++; } echo $message . "<br />"; } } // Return true if all query's where successful. Else return false if ($error_output == 0) { return TRUE; } else { return FALSE; } exit; }
<?php try { $conn = new SoapClient(NULL, array('location' => "http://127.0.0.1:7878/", 'uri' => 'urn:TC', 'style' => SOAP_RPC, 'login' => 'soap', 'password' => 'X')); echo $conn->executeCommand(new SoapParam('server info', 'command')); } catch (Exception $e) { print_r($e); }
array_push($item_arr, $item_a); } if (strpos($chunk, 'ZyID') !== false) { // Add the item. $money = trim($line_split[$k + 1]); } } if ($arr_size == count($item_arr) && isset($item)) { // Array size didn't increase.. Need to add the array item manually. $item_a = array($item, $item_count, $item_enchant); array_push($item_arr, $item_a); } } $command = 'account create ' . $account_name . ' ' . $account_pw; try { $result = $client->executeCommand(new SoapParam($command, 'command')); } catch (Exception $e) { echo 'Account create exception: ', $e->getMessage(), "\n"; return 1; } if (!isset($result)) { echo 'Account creation failed!<br>'; return 1; } $command = 'character create ' . $account_name . ' ' . $character_name . ' ' . $character_race . ' ' . $character_class . ' ' . $character_gender . ' ' . $character_skin . ' ' . $character_face . ' ' . $character_hairStyle . ' ' . $character_hairColor . ' ' . $character_facialHair . ' ' . $character_outfitId; unset($result); try { $result = $client->executeCommand(new SoapParam($command, 'command')); } catch (Exception $e) { echo 'Character create exception: ', $e->getMessage(), "\n"; return 1;