Something like this should work
function cwp7_ChangePackage($params){
$postvars = array('key' => $params["serveraccesshash"],'acction' => 'udp','user' => $params["username"], 'package' =>$params["configoption1"]);
$postdata = http_build_query($postvars);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://'. $params["serverhostname"] . ':2304/v1/account');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
logModuleCall('cwpwhmcs','cwp7_ChangePackage','https://' . $params["serverhostname"] . ':2304/v1/account'.$postdata,$answer);
}