This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-type: text/html"); | |
// | |
// Run composer with a PHP script in browser | |
// | |
// http://stackoverflow.com/questions/17219436/run-composer-with-a-php-script-in-browser | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
class HandleCorsMiddleware | |
{ | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use SoapClient; | |
class SoapController extends Controller | |
{ | |
public function show() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JJSQUADY (Jorge Alberto Junior) | |
// Abril/2017 | |
// ------------------------------------------------------------------------------------------------------------------------- | |
// Insira este código dentro de uma function | |
// Se quiser passar o CNES via parâmetro basta comentar o $cnesEstabelecimento e usar essa variável como argumento da função | |
// não esqueça de importar a classe WsseAuthHeader | |
$client = new \SoapClient('https://servicos.saude.gov.br/cnes/EstabelecimentoSaudeService/v1r0?wsdl'); | |
$client->__setSoapHeaders(new WsseAuthHeader('CNES.PUBLICO', 'cnes#2015public')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace SoapAuth | |
use SoapHeader; | |
use stdClass; | |
use SoapVar; | |
class WsseAuthHeader extends SoapHeader { | |
private $wss_ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; | |
// Não é obrigatório - It's not required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCooperativas($table) | |
{ | |
$coopTable = $table->nextSibling(); | |
//percorre até a próxima tabela | |
do | |
{ | |
$coopTable = $coopTable->nextSibling(); | |
} while($coopTable->tag != "table"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// metodo pra obter os dados do estabelecimento | |
function getIdentificacao($table) | |
{ | |
$table = $table->nextSibling(); | |
$identificacao = []; | |
foreach ($table->children() as $tr) { | |
// monta as $keys de origem de dados | |
$keys = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($tables as $table) | |
{ | |
// $table->children(0) = primeiro TR | |
// $table->children(0)->children(0) - primeiro TD | |
if ($table->children(0)->children(0) != null) | |
{ | |
// monta o array com as chaves para encontrar as tabelas | |
// o nome do indice atrelado aos dados obtidos | |
// e a função que é chamada para obter os dados de cada seção | |
//---------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: Jorge | |
* Date: 27/03/2017 | |
* Time: 13:31 | |
*/ | |
require 'vendor/autoload.php'; |