/** Use the generator to call this webservice. You need to set the pieces first. To do so you need to call changePosition_fen or changePosition_array. Once you have that set you can print out microboard. If you want to use the standard board, you need to have css set properly. To do that put the function defaultStyle_header in your head section. If you want to see the css and edit turn the text in the function to TRUE. You are print the board. */ class chessPrinter{ /** Connects to the webservice @var soapClient */ public $ws; public $serverId; /** This is to call hidden functions */ public function __call($name,$arguments){ return $this->ws->__soapCall($name, $arguments); } /** This is to call functions using old code */ public function __soapCall($name,$arguments){ return $this->ws->__soapCall($name, $arguments); } /** This is to set cookie values functions */ public function setCookies($cookies_csv){ if($cookies_csv != null){ $splitCookies = explode(",",$cookies_csv); foreach($splitCookies as $currentCookie){ $subSplit= explode("=",$currentCookie); $this->ws->__setCookie($subSplit[0], $subSplit[1]); } } } /** Used for testing a connection to the web service. */ public function __construct($cookies_csv=null){ $this->serverId="http://soap.peterdownie.com/webServices/chessPrinter/server.php"; $this->ws = new SoapClient(null,array("uri"=>"$this->serverId","location"=>"$this->serverId")); $this->setCookies($cookies_csv); return $this->ws->__soapCall("__construct",array()); } /** Possible board_type = standard, micro Needs pieces to be set standard needs display values in header. Micro and standard comments should be added here. If board is standard, if you add an array element of withTitle to it, it will show titles */ public function board_output($board_type,$color,$options){ return $this->ws->__soapCall("board_output",array($board_type,$color,$options)); } /** Change position is changePosition_array and changePosition_fen combined to reduce learning curve. if type = fen then you can supply the input of the fen if type = array then input is an array of white and black the array contains pieces of Ke1, Pa1,Pa2 etc. */ public function changePosition($type,$input){ return $this->ws->__soapCall("changePosition",array($type,$input)); } /** Call this function in the head to get results that look like a chess game! You need to use this along with printWhite or PrintBlack You can now get the text value by setting text to true */ public function defaultStyle_header($text=FALSE){ return $this->ws->__soapCall("defaultStyle_header",array($text)); } }