function GetToken($vepUID, $vepPWD) { //create soap client, setting username and password $client = new SoapClient('ms-token.wsdl', array('login' => $vepUID, 'password' => $vepPWD)); $client_ip = $_SERVER['REMOTE_ADDR']; //not localhost //Build the tokenspecification object http://msdn.microsoft.com/en-us/library/cc966768.aspx $tokenSpecification = array('ClientIPAddress' => $client_ip, 'TokenValidityDurationMinutes' => 15); $getClientToken = array('specification' => $tokenSpecification); //call GetClientToken method of token service http://msdn.microsoft.com/en-us/library/cc980876.aspx $result = $client->GetClientToken($getClientToken); return $result->GetClientTokenResult; }