Example #1
0
 /**
  * Método para solicitar la semilla para la autenticación automática.
  * Nota: la semilla tiene una validez de 2 minutos.
  *
  * WSDL producción: https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL
  * WSDL certificación: https://maullin.sii.cl/DTEWS/CrSeed.jws?WSDL
  *
  * @return Semilla obtenida desde SII
  * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
  * @version 2014-12-18
  */
 private static function getSeed()
 {
     $soap = new \SoapClient(Sii_WSDL::get('CrSeed', Sii_WSDL::PRODUCCION));
     for ($i = 0; $i < self::$retry; $i++) {
         try {
             $body = $soap->getSeed();
             break;
         } catch (\Exception $e) {
             $body = null;
         }
     }
     if ($body === null) {
         return false;
     }
     $xml = new \SimpleXMLElement($body);
     if ((string) $xml->xpath('/SII:RESPUESTA/SII:RESP_HDR/ESTADO')[0] !== '00') {
         return false;
     }
     return (string) $xml->xpath('/SII:RESPUESTA/SII:RESP_BODY/SEMILLA')[0];
 }