Search code examples
phpplivo

SMS is not going using Plivo


I am trying to send msg to a number using Plivo API in PHP. I at first I gave two USA numbers as source and destination. It didn't worked so I gave Indian Non DND numbers after that. Still the code is not working. As I am trying this for the first time can anyone please help me what is the error. (Note:: I am using Code-igniter framework)

public function sendsms()
    {
        $this->load->helper('url');
        require_once APPPATH.'libraries/plivo_php/plivo.php';
        $auth_id = "MAYZU4MDGXXXXXXXXXXX";
        $auth_token = "M2JmYTQwMDY1MTXXXXXXXXXXXXXXXXXXXXXXXXXX";

        $p = new RestAPI($auth_id, $auth_token);

        // Send a message
        $params = array(
            'src' => '917XXXXXXXXX',
            'dst' => '919XXXXXXXXX',
            'text' => 'Hi, Message from Srusti',
            'type' => 'sms'
        );

        $response = $p -> send_message($params);
        // Print the response
        echo "Response : ";
        print_r ($response['response']);
        $this->load->view('sendsms');//Here sendsms is the view name..
    }

Solution

  • Dear there may be following possibilities may happen.

    1. Check you Auth Token and Auth ID.
    2. Login to your Plivo Account and check either you can send sms to international number with this auth token and auth id.
    3. Check the path you are using for the class Plivo(plivo.php).

    These are the issues that may causing an error.