Perfect - that was the info I needed. My code now looks like this:
if($user->getString('cb_phone_1')<>'' || $user->getString('cb_phone_2')<>''){ //Only if number has been entered in phone field
$mode = 'send';
if ($user->getString('cb_phone_1')<>'') {$phone[] = "45" . $user->getString('cb_phone_1');}
if ($user->getString('cb_phone_2')<>'') {$phone[] = "45" . $user->getString('cb_phone_2');}
$message = "Hej\n\nDu har stadig ikke betalt dit ventelistegebyr! Du vil blive slettet fra ventelisten inden 5 dage, hvis du ikke betaler! For hjælp skriv til vente@xxxxxx.dk, med dit ventelistenummer (" . $user->getString('cb_waitingnumber') . ").
\n\nDu kan IKKE svare på denne SMS!";
//set POST variables
$url = '
api.xxxxxx.dk/v2/send
';
//$message = rawurlencode($message);
$fields = array(
'to' => $phone,
'message' => $message,
'from' => 'xxxxxx'
);
$fields_string = json_encode($fields);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
$headers = array(
"Accept: application/json",
"Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type: application/json",
);
curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_PORT, $serverport);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
//execute post
$response = curl_exec($ch);
//close connection
curl_close($ch);
mail("mail@xxxxxx.dk","Mail fra xxxxxxx - husk at slå fra igen !!",$response);