1

In this code I have am using sms gateway to send message to client. Now, sms sent successfully but format look plain like:

This is a remainder about the title by the 2019-11-11 hello

it look simple I want to show message should be like:

This is a remainder about the title by 2019-11-11 hello Line should be break after about, title, date and message

So How can I do this? Please help me.

Thank You

$message = "This is a reminder about the ".$this->input->post("title")." by the ".date("Y-m-d", strtotime($this->input->post("date")))." ".strip_tags(html_entity_decode($this->input->post("notice")))."";
$requestParams = array(
    'user' => '**********',
    'pass' => '**********',
    'sender' => '*******',
    'phone' => trim(json_encode($student_phone, JSON_NUMERIC_CHECK),'[]'),
    'text' => $message,
    'priority' => 'ndnd',
    'stype' => 'normal'
);
$apiUrl = "http://bhashsms.com/api/sendmsg.php?";
foreach($requestParams as $key => $val){
    $apiUrl .= $key.'='.urlencode($val).'&';
}

$apiUrl = rtrim($apiUrl, "&");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
$return = json_encode($result);
1
  • It's unclear, at least for me, how is the format you want different from the one that's working right now. All I see is that the preposition "the" is missing. Commented Nov 11, 2019 at 10:12

1 Answer 1

2

Try with "new line" character \n. Insert it in the string like this:

$message = "This is a reminder about \n the ".$this->input->post("title")."\n by the ".date("Y-m-d", strtotime($this->input->post("date")))."\n".strip_tags(html_entity_decode($this->input->post("notice")))."";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.