我目前在通过化学从Alfresco下载文件时遇到问题。
这是我的代码:
// Create the session
$repository = new CMISService($repositoryUrl, $userName, $password);
$uuid = $_GET['uuid'];
$contentData = $repository->getObject($uuid);
$tempurl = $repository->getLastRequestURL();
// TEMPORARY URL IS THIS: "http://193.43.168.90:8082/alfresco/api/-default-/public/cmis/versions/1.1/atom/id?id=6b82d8db-2003-467d-91e3-17a2d27f6a68";
$fp = fopen($tempurl, 'r');
$DMSContent = stream_get_contents($fp);
fclose($fp);
我无法下载该文件,因为它返回了“ HTTP请求失败!HTTP / 1.1 401未经授权”。就像我没有登录Alfresco。我怎样才能做到这一点?
在与Alfresco CMIS和化学一起工作时,我也有类似的经历,但尚未使它起作用。以下是变通办法:
使用专门用于获取文件的REST api下载servlet:
https://wiki.alfresco.com/wiki/URL_Addressability#DownloadContentServlet
您需要先获得一张票:
/ alfresco / service / api / login?u =用户名&pw =密码
它将在xml标记之间返回,您可以轻松地将其解析出来,并将其作为alf_ticket参数传递给下载servlet。
问候
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句