Home » Php » find value from API callback url

find value from API callback url

Posted by: admin October 20, 2018 Leave a comment

Questions:

I am using an API for sending sms in my site. As per their documentation, the API structure is as follows:

http://example.com/api/swsend.asp?username=xxxx&password=xxxx&sender=senderId&sendto=919xxxx,919xxxx&message=hello&dlrUrl=http://yourServer_Url?logID=$logID$%26phNo=$phNO$%26result=$result$  

the message sending part is OK. But I am confused with Callback url. My function for callback is as follows:

public function sendMessageCallback() {        

    $responseBody = file_get_contents('php://input');  

    $data = array('value' => $responseBody, 'date' => date('Y-m-d h:i:s'));
    $this->db->insert('test1', $data);
}

and so my api call is like
http://example.com/api/swsend.asp?username=xxxx&password=xxxx&sender=senderId&sendto=919xxxx,919xxxx&message=hello&dlrUrl=http://example.in/API/sendMessageCallback

But nothing is written to DB.

Answers: