Skip to content

Instantly share code, notes, and snippets.

@jjcodes78
Created April 1, 2017 07:12
Show Gist options
  • Save jjcodes78/4fd73a8b2fa1dffeb2ba36d961777c02 to your computer and use it in GitHub Desktop.
Save jjcodes78/4fd73a8b2fa1dffeb2ba36d961777c02 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use SoapClient;
class SoapController extends Controller
{
public function show()
{
$client = new SoapClient('https://servicos.saude.gov.br/cnes/EstabelecimentoSaudeService/v1r0?wsdl');
$client->__setSoapHeaders(new WsseAuthHeader('CNES.PUBLICO', 'cnes#2015public'));
$cnesEstabelecimento = '9020535';
$requestConsultarEstabelecimentoSaude = [
'FiltroPesquisaEstabelecimentoSaude' => [
'CodigoCNES' => [
'codigo' => $cnesEstabelecimento
]
]
];
$response = json_decode(json_encode($client->consultarEstabelecimentoSaude($requestConsultarEstabelecimentoSaude)), true);
return $response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment