本文介绍了如何使用R运行ldap查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查询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 ):

但是我不是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)"

这里有人知道如何使用RCurl在R中执行相同的操作吗?

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属性"范围过滤器):

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查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-08 07:17