在SMS集成中获取错误Codeigniter

时间:2017-09-01 09:59:32

标签: php codeigniter

我已将SMS发送代码集成到我的网站,以便向特定用户发送消息。整合短信代码后,它成功发送消息,但客户端服务器显示错误

 Failed : Mobile number value is missing Success: Message id: *************

我完全对此感到困惑,因为它不会发生在localhost上,而是显示在客户端服务器上。

我在这里编辑了我的代码: -

    $message2 = "Dear " . $this->input->post('patient_name') . ".your appointment (" . $docdata->id . ") with Dr." . $docdata->f_name . " " . $docdata->l_name . " has been confirmed at " . $docdata->location . " ," . date('h:i A', strtotime($this->input->post('appoitment_time'))) . "," . date('d-m-Y', strtotime($this->input->post('appointment_date'))) . ".For any help";
    $subject ="MyWebsite";
    $content = "Dear " . $this->input->post('name') .",<br />". "your appointment (" . $docdata->id . ") with Dr." . $docdata->f_name . " " . $docdata->l_name . " has been confirmed at "."-<br />". $docdata->location . " ," . date('h:i A', strtotime($this->input->post('appoitment_time'))) . "," . date('d-m-Y', strtotime($this->input->post('appointment_date'))) .".<br />"."For any help";

    $user_id = 'Website'; // Your Username
    $pwd = '**********';    // Your Password
    $sender_id = 'ABCDE';  // Add 6 char sender id viz: HDFCBK
    $mobile_num = $this->input->post('phone');  // Mobile Number, You can add comma separated mobile number
    $email_id = $this->input->post('email');  // Email Address, You can add comma separated email id
    $this->sendMail($this->input->post('email'), $subject,$content,"abc@gmail.com");

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://tra.bulksmshyderabad.co.in/websms/sendsms.aspx?userid=" . $user_id . "&password=" . $pwd . "&sender=" . $sender_id . "&mobileno=" . urlencode($mobile_num) . "&msg=" . urlencode($message2));
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $output = curl_exec($ch);
    curl_close($ch);

请检查..

任何人都可以帮忙解决这个问题。哪里出错了。 任何帮助将不胜感激。

提前致谢

1 个答案:

答案 0 :(得分:1)

我现在没有我的实例来测试这个,但你可以尝试下面的代码。

$curl = curl_init();
$strMessage  = urlencode(" Write Your message here ");
curl_setopt($curl, CURLOPT_URL, "http://your url with parameters(like $strMessage)");  
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_exec($curl);
curl_close($curl);