问题描述
我想针对 LDAP 目录查询员工在部门和组中的分布情况...
I want to make a query against a LDAP directory of how employees are distributed in departments and groups...
类似:给我一个组所有成员的部门名称"然后使用R进行频率分析,但我找不到任何关于如何连接和运行的示例使用 R 的 LDAP 查询.
Something like: "Give me the department name of all the members of a group" and then use R to make a frequency analysis, but I can not find any examples on how to connect and run a LDAP query using R.
RCurl 似乎有某种支持( http://cran.r-project.org/web/packages/RCurl/index.html):
RCurl seems to have some kind of support ( http://cran.r-project.org/web/packages/RCurl/index.html ):
此外,底层实现功能强大且广泛,支持 FTP/FTPS/TFTP(上传和下载)、SSL/HTTPS、telnet、dict、ldap,还支持cookies、重定向、身份验证等.
但我不是 R 方面的专家,也无法找到使用 RCurl( 或任何其他 R 库)来执行此操作的单个示例..
But I am no expert in R and have not been able to find a single example using RCurl (or any other R library) to do this..
现在我正在像这样使用 CURL 来获取组的成员:
Right now I am using CURL like this to obtain the members of a group:
curl "ldap://ldap.replaceme.com/o=replaceme.com?memberuid?sub?(cn=group-name)"
这里有人知道如何在 R 中使用 RCurl 做同样的事情吗?
Anyone here knows how to do the same in R with RCurl?
推荐答案
自己找到答案了:
首先运行此命令以确保已安装 RCurl(如 http://www.programmingr.com/content/webscraping-using-readlines-and-rcurl/):
First run this commands to make sure RCurl is installed (as described in http://www.programmingr.com/content/webscraping-using-readlines-and-rcurl/ ):
install.packages("RCurl", dependencies = TRUE)
library("RCurl")
然后使用 ldap URL 用户 getURL(如 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
):
And then user getURL with an ldap URL (as described in http://www.ietf.org/rfc/rfc2255.txt although I couldn't understand it until I read http://docs.oracle.com/cd/E19396-01/817-7616/ldurl.html and saw ldap[s]://hostname:port/base_dn?attributes?scope?filter
):
getURL("ldap://ldap.replaceme.com/o=replaceme.com?memberuid?sub?(cn=group-name)")
这篇关于如何使用 R 运行 ldap 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!