我想对 LDAP 目录进行查询,了解员工在部门和组中的分布情况...
类似于:“给我一个组所有成员的部门名称”,然后使用 R 进行频率分析,但我找不到有关如何使用 R 连接和运行 LDAP 查询的任何示例。
RCurl 似乎有某种支持( http://cran.r-project.org/web/packages/RCurl/index.html ):
Additionally, the underlying implementation is robust and extensive, supporting FTP/FTPS/TFTP (uploads and downloads), SSL/HTTPS, telnet, dict, ldap, and also supports cookies, redirects, authentication, etc.
但是我不是 R 方面的专家,并且无法找到使用 RCurl(或任何其他 R 库)来执行此操作的单个示例。
现在我正在使用 curl 像这样获取组的成员:
curl "ldap://ldap.replaceme.com/o=replaceme.com?memberuid?sub?(cn=group-name)"
这里有人知道如何使用 RCurl 在 R 中做同样的事情吗?
最佳答案
自己找到了答案:
首先运行此命令以确保安装了 RCurl(如 http://www.programmingr.com/content/webscraping-using-readlines-and-rcurl/ 中所述):
install.packages("RCurl", dependencies = TRUE)
library("RCurl")
然后用户 getURL 和一个 ldap URL(如 http://www.ietf.org/rfc/rfc2255.txt 中所述,尽管在我阅读 http://docs.oracle.com/cd/E19396-01/817-7616/ldurl.html 并看到
ldap[s]://hostname:port/base_dn?attributes?scope?filter
之前我无法理解它):getURL("ldap://ldap.replaceme.com/o=replaceme.com?memberuid?sub?(cn=group-name)")
关于r - 如何使用 R 运行 ldap 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22793855/