public function attachFiles($ticketid, $images)
{
$access_token = $this->get_access_token();
if(isset($images) && !empty($images)){
foreach($images as $key => $image) {
$ch_image = curl_init();
curl_setopt( $ch_image, CURLOPT_URL, 'https://desk.zoho.com.au/api/v1/tickets/'.$ticketid.'/attachments?isPublic=true' );
curl_setopt( $ch_image, CURLOPT_POST, true );
$post_fields = array(
'file' => new CURLFile($image)
);
curl_setopt($ch_image, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch_image, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch_image, CURLOPT_HTTPHEADER, array(
'Authorization: Zoho-oauthtoken ' . $access_token,
'orgId: ******',
'Content-Type:multipart/form-data'
) );
$img_response = curl_exec( $ch_image );
curl_close($ch_image);
$image_upload_response = json_decode($img_response, true);
print_r($image_upload_response); //this is empty!?
}
}
Writer is a powerful online word processor, designed for collaborative work.