如何使用 PHP 从我的网站访问来自 windows 机器的 windows 服务或数据?

How can I access windows services or data from windows machine from my website using PHP?

这是关于 PHP 中单点登录的实现。

I have a website say abc.com, I want to check, is user logged into his/her outlook mail? Means I want to get email address of the user from his local machine by using website to implement Single sign-in on web.

Or you can say I want to check user profile (email-id which one used on windows machine to get access windows applications)

可能还有另一种解决方法,例如如果用户正在使用 window 系统并且他已登录到 outlook,这意味着任何特定网站,link 或 api 将 return 一些标志等

你可以只使用 Microsoft Graph SDK for PHP to make Outlook API Calls. In order to do it, you can follow this tutorial.

这将要求用户每次都登录才能授予访问权限。要修复它,.

Active directory is used for managing users within a network, now a days Microsoft using cloud based solutions like Azure with SAML 2.0 etc.

However your question is about use of active directory then first of all you have to understand about active directory domain settings, AD is used for getting system user info to verify access level created for a specific user. In .Net simple code for getting AD user with domain is :

     public static void Main() {
     DisplayUser(WindowsIdentity.GetCurrent());
     Console.ReadKey();    
 }

 public static void DisplayUser(IIdentity id) {    
     WindowsIdentity winId = id as WindowsIdentity;
     if (id == null) {
         Console.WriteLine("Identity is not a windows identity");
         return;
     }

     string userInQuestion = winId.Name.Split('\')[1];
     string myDomain = winId.Name.Split('\')[0]; // this is the domain that the user is in
      // the account that this program runs in should be authenticated in there                    
     DirectoryEntry entry = new DirectoryEntry("LDAP://" + myDomain);
     DirectorySearcher adSearcher = new DirectorySearcher(entry);

     adSearcher.SearchScope = SearchScope.Subtree;
     adSearcher.Filter = "(&(objectClass=user)(samaccountname=" + userInQuestion + "))";
     SearchResult userObject = adSearcher.FindOne();
     if (userObject != null) {
         string[] props = new string[] { "title", "mail" };
         foreach (string prop in props) {
             Console.WriteLine("{0} : {1}", prop, userObject.Properties[prop][0]);
         }
     }
 }

其实获取系统用户名和获取微软登录邮箱是两个不同的过程

要获取系统或 OS 用户,您可以使用下面的 javascript 代码,称为 activeXObject,为此您必须在 IE 中从安全选项卡启用 activeXObject(我刚刚针对 Internet 测试了它探索者):

   $(document).ready(function () { 

     try {
      var activex = new ActiveXObject('WScript.Network');
      alert(activex.userName);
    } catch (ex) {
      alert("unable to get user info");
    }
}

So finally answer of your question you can't get email id directly without using AD or SAML etc.