0
您好我有这样的PHP代码(自定义脚本)从RightNow的事件查询FileAttachment的URL,下载图像WebDAV文件夹的网址用新的名称和检索
<?php
define("CUSTOM_SCRIPT", true);
define(DEBUG, false);
define(COMMIT, true);
ini_set('display_errors',1);
error_reporting(E_ALL^E_NOTICE);
$ip_dbreq = true;
require_once(get_cfg_var("doc_root")."/ConnectPHP/Connect_init.php");
use RightNow\Connect\v1_2 as RNCPHP;
try{
initConnectAPI('user','Pass');
}
catch(Exception $error) {
echo $error->getMessage();
}
$img_url = "";
$inc_id = 296;
$entity = RNCPHP\Incident::fetch($inc_id);
foreach($entity->FileAttachments as $fileattach) {
$img_url = $fileattach->getAdminURL();
}
$img_id = 23;
$image_location = HTMLROOT . "/euf/assets/images/integration_images/images/".$inc_id."-".$img_id.".png";
file_put_contents($img_url, fopen($image_location , 'r'));
header('Location: $image_location');
?>
这将返回文件下载网址这要是在浏览器中打开会自动将图像下载到我的电脑
我想使用此URL将图像直接下载到客户门户文件夹 “/ euf/assets/images /”,其中包含事件ID和图像ID作为名称,然后为该图像构建一个新url并重定向我的上面脚本指向该图像url,以便我们可以直接在浏览器上看到图像。