Skip to content

Instantly share code, notes, and snippets.

@cesjam7
Created February 23, 2021 21:49
Show Gist options
  • Save cesjam7/c057ce0216fe8ca9aa24fed58b5e0061 to your computer and use it in GitHub Desktop.
Save cesjam7/c057ce0216fe8ca9aa24fed58b5e0061 to your computer and use it in GitHub Desktop.
Enviar Guia de Remisión a SUNAT
<?php $ruta_ws_prod = 'https://e-guiaremision.sunat.gob.pe/ol-ti-itemision-guia-gem/billService?wsdl';
$ruc = '20552543549';
$usuario_sol = 'SUPER021';
$pass_sol = 'Super021';
$client = new \SoapClient($ruta_ws_prod, array("trace" => true, "soap_version" => SOAP_1_1, 'exceptions'=>FALSE, 'cache_wsdl' => WSDL_CACHE_NONE));
$WSHeader = '<ns2:Security><ns2:UsernameToken><ns2:Username>' . $ruc . $usuario_sol . '</ns2:Username><ns2:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $pass_sol . '</ns2:Password></ns2:UsernameToken></ns2:Security>';
$headers = new \SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', new \SoapVar($WSHeader, XSD_ANYXML));
$client->__setSoapHeaders($headers);
$result = $client->sendBill(array(
'fileName' => $name_file_zip_cpe,
'contentFile' => $base64_file_zip_cpe
));
return $client->__getLastRequest().'<pre>'.print_r($result, 1).'</pre>';
return $client->__getLastRequest().'----------'.$client->__getLastResponse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment