Develop PHP SOAP - aliconnect/aliconnect.sdk GitHub Wiki

Develop PHP SOAP

Introductie

Build control application

Server

class aim {
  public function test(){
    return "Result";
  }
}

ini_set( "soap.wsdl_cache_enabled", 0 );
ini_set( 'soap.wsdl_cache_ttl', 0 );
$server = new SoapServer(NULL, [
  'uri' => 'http://localhost/sample/soap/server.php'
]);
$server->setClass(aim);
$server->handle();
die();

Client

$aim = new SoapClient(null,$options = [
  'location'   => 'http://localhost/sample/soap/server.php', // url of the soap server
  'uri'     => 'http://localhost/sample/soap/client.php', // url of the soap client
  //'uri' => ($_SERVER[HTTPS]==off ? "http" : "https")."://".$_SERVER[SERVER_NAME].$_SERVER[URL], // url of the client || current file "http://localhost/sample/connect/php/"
  // 'login' => 'test',//self::$config[client_id], // user name or client_id
  // 'password' => $_COOKIE["access_token"], // user password or access_token
]);
//die(json_encode($options));
$result = $aim->test();
die($result);
//var_dump($aim);