[rt-users] rt & asterisk

Shahab Sharifzadeh sshguard at ymail.com
Wed Nov 5 08:20:52 EST 2014

Thanks you...

i tried according to my search in web wrote the following code by php:


$attachment_1 = file_get_contents('/opt/app/test/1.jpg'); 
$content = "id: 12\n"; 
$content = $content . "Action: comment\n"; 
$content = $content . "Text: Im adding some text\n And adding some more 
text\n And some more\n"; 
$content = $content . "TimeWorked: 30\n"; 
$content = $content . "Attachment: 1.jpg\n"; 
$request = '';  
$request .= 'ticket/12/comment'; 

$postargs = array( 
        'user' => 'root', 
        'pass' => 'Nasim1414', 
        'content' => $content, 
        'attachment_1' => $attachment_1 

// get the curl session object 
$session = curl_init($request); 

// set the POST options 
curl_setopt ($session, CURLOPT_POST, true); 
curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs); 
curl_setopt($session, CURLOPT_HEADER, true); 
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 
curl_setopt( $session, CURLOPT_HTTPHEADER, array( 'Expect:' ) ); 

// do the POST and then close the session 
$response = curl_exec($session); 


But i Do not know Why not run and Gives the following message:

HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 03:37:57 GMT
Server: Apache/2.4.7 (Ubuntu)
Set-Cookie: RT_SID_tickets.80=53fc8c23dd35759180ae28e5edb2a967; path=/rt; HttpOnly
X-Frame-Options: DENY
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8

RT/4.0.19 400 Bad Request

# No attachment for 1.jpg

please help...

More information about the rt-users mailing list