get_variable('CODCLI',true); $codSerCli = $agi->get_variable('CODSERCLI',true); $codCar = $agi->get_variable('CODCAR',true); $nome_ocop = $agi->get_variable('NOME_OCOP',true); $cpf = $agi->get_variable('CPF_CNPJ',true); $nomeCli = $agi->get_variable('NOME_CLIENTE',true); $chamado = abreChamado($codCli, $codSerCli, $codCli, $codCar, 'ATENDIMENTO_URA', ''); __logStr("Abre Chamado", "Resultado: ". print_r($chamado,true),$script, true); try { if ($chamado['numero_oco']){ GetProto($connPG, $uid, $chamado['numero_oco']); $retorno_cliente = sprintf("%s|%s|%s|Nome:%s|Protocolo:%s|CPF_CNPJ:%s|Atendimento:%s", $uid,$numero,'98', str_replace("|", "", $nomeCli), str_replace("|", "", $chamado['numero_oco']), str_replace("|", "", $cpf), str_replace("|", "", $nome_ocop)); $agi->exec_goto(GetFila('RELACIONAMENTO')); }else{ $agi->exec_goto(GetFila('RELACIONAMENTO')); } } catch (Exception $ex) { $reg_msg = $ex->getMessage(); $reg_status_exec = 'Er'; __logStr("Abre Chamado", $reg_msg, $script, true); } @AtualizaIntegracao($uid, $reg_retorno, $reg_msg, $reg_status_exec, $retorno_cliente); if (!$dadosIntegra) @grava_dadosIntegra($reg_retorno); function abreChamado($_codcli, $_codsercli, $_login, $_codcar, $_obs, $_chat) { $url = 'http://177.74.128.21/server.php'; $_user = rawurlencode('254R0JIT4V'); $_passwd = rawurlencode('254R0JITNP'); $xml = '' . "\n"; $xml .= "\n"; $xml .= "ati.criarAtendimento\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= ""; try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8', 'Content-Length: ' . strlen($xml))); $result = curl_exec($ch); $curlError = curl_error($ch); if ($curlError == '') { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 200) { if ($result == '') { throw new Exception("Retorno Vazio"); } else { $xml = simplexml_load_string($result); $return = array(); $return['numero_oco'] = (string) $xml->params->param[1]->value->string; } } else { throw new Exception("HTTP error ocurred, number: $httpCode"); } } else { curl_close($ch); throw new Exception("HTTP error ocurred: $curlError"); } } catch (Exception $ex) { $msg = $ex->getMessage(); return $msg; } return $return; } ?>