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,以便我們可以直接在瀏覽器上看到圖像。