Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
titlePHP Sample
// The sample code described herein is provided on an "as is" basis, without warranty of any kind. 
// MailUp shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
class MailUpWsSend {
	protected $WSDLUrl = "";
	private $soapClient;
	private $xmlResponse;
	protected $domResult;
	function __construct() {
		$this->soapClient = new SoapClient($this->WSDLUrl, array("trace" => 1, "exceptions" => 0));
	function __destruct() {
	public function getFunctions() {
	public function loginFromId() {
		try {
			$loginData = array("user" => "user",
						       "pwd" => "password",
						       "consoleId" => "idconsole");
			if ($this->readReturnCode("LoginFromId","errorCode") != 0) {
				echo "<br /><br />Error in LoginFromId: ". $this->readReturnCode("LoginFromId","errorDescription");
			else $this->accessKey = $this->readReturnCode("LoginFromId","accessKey");
			echo "<br>AccesKey: ". $this->accessKey;
			} catch (SoapFault $soapFault) {	
	public function logout() {
		try {
			$this->soapClient->Logout(array("accessKey" => $this->accessKey));
			if ($this->readReturnCode("Logout","errorCode") != 0) 
				echo "<br /><br />Error in Logout". $this->readReturnCode("Logout","errorDescription");
			} catch (SoapFault $soapFault) {	
	private function readReturnCode($func, $param) {
		$this->xmlResponse = $this->soapClient->__getLastResponse();
		$dom = new DomDocument();
		$dom->loadXML($this->xmlResponse) or die("(1)XML file is not valid!");
		$xmlResult = $dom->getElementsByTagName($func."Result");
		$this->domResult = new DomDocument();
		$this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die("(2)XML file is not valid!");
		$rCode = $this->domResult->getElementsByTagName($param);
		return $rCode->item(0)->nodeValue;
	//... other functions...
	// public function functionName(...) {...}
	$WsSend = new MailUpWsSend();
	// use $WsSend->functionName(...) to call other methods	


Logout method

Deletes the accessKey from the list, so that it can be no longer used. In case the method is not calledThis method has become useless, the accessKey remains active for 60 minutes
  • string Logout(string accessKey)
  • accessKey: access key obtained by calling the Login method
  • LogoutResult: string containing the outcome of the operation

SOAP Examples

Code Block