Я пытаюсь реализовать nexmo sms api для получения смс с телефона и сохранения в таблице mysql. я взял учетную запись в nexmo. Я документировал документацию. но спутать, как использовать егоКто-нибудь знает, как получить sms в php-скрипт, используя nexmo sms api
https://docs.nexmo.com/messaging/sms-api
am trying to implement nexmo sms api to receive sms from phone and save to mysql table. i took account in nexmo. i ckeched the documentation. but confused how to use it
кто-нибудь знает, как получить смс на мой сценарий при отправке смс с телефона, то пожалуйста, помогите мне я хочу получать смс на сценарий и сохранить тузды таблицы
public function myinformation() {
$request = array_merge($_GET, $_POST);
// Check that this is a delivery receipt.
if (!isset($request['messageId']) OR !isset($request['status'])) {
error_log('This is not a delivery receipt');
return;
}
//Check if your message has been delivered correctly.
if ($request['status'] == 'delivered') {
error_log("Your message to {$request['msisdn']} (message id {$request['messageId']}) was delivered.");
error_log("The cost was {$request['price']}.");
$From = $this->input->post('[email protected]');
$ToEmail = $this->input->post('[email protected]');
$message = "Results: " . print_r($request, true);
$this->load->library('email');
$subject = 'My Attempt';
// Get full html:
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
body {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
' . $message . '
</body>
</html>';
$result = $this->email
->from($From)
// Optional, an account where a human being reads.
->to($ToEmail)
->subject($subject)
->message($body)
->send();
var_dump($result);
echo $this->email->print_debugger();
exit;
} elseif ($request['status'] != 'accepted') {
error_log("Your message to {$request['msisdn']} (message id {$request['messageId']}) was accepted by the carrier.");
error_log("The cost was {$request['price']}.");
} else {
error_log("Your message to {$request['msisdn']} has a status of: {$request['status']}.");
error_log("Check err-code {$request['err-code']} against the documentation.");
}
}
Я пробовал этот код. Но я не получал почты на свою почту.
получать SMS с телефона? или получить форму отчета о доставке, что ваш msg был доставлен или нет? –
Получать СМС с телефона – Angel
ссылку на эту ссылку: https://docs.nexmo.com/messaging/conversion-api –