http://docs.devinotele.com/viber-resender.html
Нужны зарегистрированные каналы отправки
<?php
$url = 'https://viber.devinotele.com:444/send';
$username = 'ConsulRuAvia3';
$password = 'hromosk72{{#c=A4z751';
$ch = curl_init($url);
$headers = array(
'Content-Type: application/json',
'Authorization: Basic '. base64_encode("$username:$password")
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data='{
"resendSms" : "true",
"messages" :
[ {
"subject" : "'.$username.'",
"priority" : "realtime",
"validityPeriodSec" : 3600,
"comment" : "comment",
"type" : "viber",
"contentType" : "text",
"content" :
{
"text" : "'.$_GET['text'].'"
},
"address" : "'.$_GET['tel'].'",
"smsText":"'.$_GET['text'].'",
"smsSrcAddress":"'.$username.'",
"smsValidityPeriodSec":5000
} ]
}';
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reply=curl_exec($ch);
curl_close($ch);
echo $reply;
?>
<form>
<input name="tel" value="79199610491"><br>
<input name="text" value="Hellowold!!!"><br>
<input type="submit" value="Send">
</form>
рабочий код
http://u0715817.cp.regruhosting.ru/ind_viber.php
рабочий\
<?php
$url = 'https://viber.devinotele.com:444/send';
$username = 'ConsulRu';
$password = 'k72{{#c=A4';
$username2 = 'Clockshop';
$ch = curl_init($url);
$headers = array(
'Content-Type: application/json',
'Authorization: Basic '. base64_encode("$username:$password")
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data='{
"resendSms" : "true",
"messages" :
[ {
"subject" : "'.$username2.'",
"priority" : "realtime",
"validityPeriodSec" : 30,
"comment" : "comment",
"type" : "viber",
"contentType" : "text",
"content" :
{
"text" : "'.$_GET['text'].'"
},
"address" : "'.$_GET['tel'].'",
"smsText":"'.$_GET['text'].'",
"smsSrcAddress":"'.$username2.'",
"smsValidityPeriodSec":60
} ]
}';
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reply=curl_exec($ch);
curl_close($ch);
echo $reply;
?>
<form>
<input name="tel" value="79199610491"><br>
<input name="text" value="Сработал http://u0715817.cp.regruhosting.ru/ind_viber.php"><br>
<input type="submit" value="Send">
</form>
Нужны зарегистрированные каналы отправки
<?php
$url = 'https://viber.devinotele.com:444/send';
$username = 'ConsulRuAvia3';
$password = 'hromosk72{{#c=A4z751';
$ch = curl_init($url);
$headers = array(
'Content-Type: application/json',
'Authorization: Basic '. base64_encode("$username:$password")
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data='{
"resendSms" : "true",
"messages" :
[ {
"subject" : "'.$username.'",
"priority" : "realtime",
"validityPeriodSec" : 3600,
"comment" : "comment",
"type" : "viber",
"contentType" : "text",
"content" :
{
"text" : "'.$_GET['text'].'"
},
"address" : "'.$_GET['tel'].'",
"smsText":"'.$_GET['text'].'",
"smsSrcAddress":"'.$username.'",
"smsValidityPeriodSec":5000
} ]
}';
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reply=curl_exec($ch);
curl_close($ch);
echo $reply;
?>
<form>
<input name="tel" value="79199610491"><br>
<input name="text" value="Hellowold!!!"><br>
<input type="submit" value="Send">
</form>
рабочий код
http://u0715817.cp.regruhosting.ru/ind_viber.php
рабочий\
<?php
$url = 'https://viber.devinotele.com:444/send';
$username = 'ConsulRu';
$password = 'k72{{#c=A4';
$username2 = 'Clockshop';
$ch = curl_init($url);
$headers = array(
'Content-Type: application/json',
'Authorization: Basic '. base64_encode("$username:$password")
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data='{
"resendSms" : "true",
"messages" :
[ {
"subject" : "'.$username2.'",
"priority" : "realtime",
"validityPeriodSec" : 30,
"comment" : "comment",
"type" : "viber",
"contentType" : "text",
"content" :
{
"text" : "'.$_GET['text'].'"
},
"address" : "'.$_GET['tel'].'",
"smsText":"'.$_GET['text'].'",
"smsSrcAddress":"'.$username2.'",
"smsValidityPeriodSec":60
} ]
}';
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reply=curl_exec($ch);
curl_close($ch);
echo $reply;
?>
<form>
<input name="tel" value="79199610491"><br>
<input name="text" value="Сработал http://u0715817.cp.regruhosting.ru/ind_viber.php"><br>
<input type="submit" value="Send">
</form>
Комментариев нет:
Отправить комментарий