dspows0637 2014-12-01 06:50
浏览 58

Sharepoint 2010 Api - 故障代码:HTTPFault字符串:未经授权

I used following code to get list for sharepoint 2010 api

    //Authentication details
$authParams = array('login' => "username",
                    'password' => 'password');
//// 
///* A string that contains either the display name or the GUID for the list.
// * It is recommended that you use the GUID, which must be surrounded by curly
// * braces ({}).
// */
$listName = "listname";
$rowLimit = '10';
// 
///* Local path to the Lists.asmx WSDL file (localhost). You must first download
// * it manually from your SharePoint site (which should be available at
// * yoursharepointsite.com/subsite/_vti_bin/Lists.asmx?WSDL)
$wsdl = "http://localhost/sharepoint/Lists.asmx.xml";


$rawXMLresponse = null;
try{
//    //Creating the SOAP client and initializing the GetListItems method parameters
    $soapClient = new SoapClient($wsdl, $authParams);
    $params = array('listName' => $listName,
                'rowLimit' => $rowLimit);
    //Calling the GetListItems Web Service
    $rawXMLresponse = $soapClient->GetListItems($params)->GetListItemsResult->any;
}
catch(SoapFault $fault){
    echo 'Fault code: '.$fault->faultcode;
    echo 'Fault string: '.$fault->faultstring;
}
echo '<pre>' . $rawXMLresponse . '</pre>';

// 
////Loading the XML result into parsable DOM elements
$dom = new DOMDocument();
$dom->loadXML($rawXMLresponse);
$results = $dom->getElementsByTagNameNS("#RowsetSchema", "*");

//Fetching the elements values. Specify more attributes as necessary
foreach($results as $result){
    echo $result->getAttribute("ows_LinkTitle")."<br/>";
}
unset($soapClient);

and getting error

    Fault code: HTTPFault string: Unauthorized

I used some third party libraries like https://github.com/thybag/PHP-SharePoint-Lists-API but still no luck.

Anyone worked on it, Please suggest me some method to get data from share point 2010 api

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动