forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
<?php |
|
|
|
include("util/util.php"); |
|
|
|
$nome = isset($_POST['lg_nome']) ? $_POST['lg_nome'] : ''; |
|
$ddd = isset($_POST['lg_ddd']) ? $_POST['lg_ddd'] : ''; |
|
$tel = isset($_POST['lg_telefone']) ? $_POST['lg_telefone'] : ''; |
|
|
|
$pagina = isset($_GET['pag']) ? $_GET['pag'] : ''; |
|
|
|
|
|
$url = sprintf("http://localhost/integracao?method=LigueGratis&numeroDiscar=%s&login=sinccontasenha&senha=s3ncC0nt@S2nh@&SIPID=hv615jnr8pc68guovgl1s61326&tipoRetorno=XML", $ddd . $tel); |
|
$ret = file_get_contents($url); |
|
$xml = simplexml_load_string($ret); |
|
|
|
if (strval($xml->status) == 'OK' && strval($xml->result) == true) { |
|
echo 'OK'; |
|
} else { |
|
echo 'FAIL'; |
|
} |
|
|
|
GetQuery($nome, $ddd . $tel, $xml->status . '|' . $xml->result, $xml->message, $xml->SIPID); |
|
|
|
function GetQuery($nome, $telefone, $result, $mensagem, $sipid) { |
|
$query = "INSERT INTO pbx_ligueme_gratis (nome_contato,telefone_contato,result_contato,mensagem_contato,sipid_contato) VALUES('$nome','$telefone','$result','$mensagem','$sipid')"; |
|
@pg_query($query); |
|
if (pg_last_error()) { |
|
$path = "/var/log/asterisk/liguemegratis.log"; |
|
$log = date('Y-m-d H:i:s')." [ ERROR ] ".pg_last_error() ."\n"; |
|
@WriteLog($log, $path); |
|
} |
|
} |
|
|
|
|