- trim: documentation ( source)
- json_encode: documentation ( source)
<?php
$params = array(
'category_id' => $this->getCategoryIdByName($service->id, $pCategoryName),
'subject' => trim($pTitle),
'body' => trim($pMessage),
'from' => array('name' => $pUserName, 'email' => $pUserEmail),
'to' => array('name' => $service->name, 'email' => $service->from),
);
echo json_encode($params);