3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checaClientePorto($cnpj, $codigoProduto=0) { if (strlen(trim($cnpj))>0) { # $filename = "https://wwws.portoseguro.com.br/ConsultaDadoSeguradoService/REST/obterDadosSegurado?cpfcnpj=$cnpj&codigoProduto=$codigoProduto"; try { $result = simplexml_load_string('<segurado> <nomeSegurado>EMERSON DA SILVA BRULL</nomeSegurado> <numeroCpfCnpj>345769118</numeroCpfCnpj> <ordemCnpj>0</ordemCnpj> <digitoCpfCnpj>56</digitoCpfCnpj> <statusSegurado>2</statusSegurado> <corretores> <susep></susep> <susep>V2064F</susep> <susep>P5005J</susep> <susep>P2371J</susep> </corretores> </segurado>'); $obj = json_decode(json_encode((array) $result)); var_dump($obj); $corretores = get_object_vars($obj->corretores); $retorno = null; if (is_array($corretores['susep'])) { foreach($result['susep'] as $susep) { if( !($susep instanceof stdClass) ) { $retorno = $susep; break; } } } else { $retorno = $result->corretores->susep; } if (is_null($retorno)) { $retorno=''; } //registrarLog(0, 0, 'Retorno Webservice: ' . $retorno); return $retorno; } catch (Exception $e) { return array("erro"=>$e->getMessage()); } } else { return 'ERROCPF'; } } $cpf ='34576911856'; echo "CPF: $cpf<br/>"; $res=checaClientePorto($cpf); print('<pre>Susep Retornado: '.$res.'</pre>'); echo "https://wwws.portoseguro.com.br/ConsultaDadoSeguradoService/REST/obterDadosSegurado?cpfcnpj=$cpf&codigoProduto=0";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g3JZC
function name:  (null)
number of ops:  17
compiled vars:  !0 = $cpf, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   ASSIGN                                                   !0, '34576911856'
   64     1        ROPE_INIT                                     3  ~4      'CPF%3A+'
          2        ROPE_ADD                                      1  ~4      ~4, !0
          3        ROPE_END                                      2  ~3      ~4, '%3Cbr%2F%3E'
          4        ECHO                                                     ~3
   65     5        INIT_FCALL                                               'checaclienteporto'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !1, $6
   66     9        CONCAT                                           ~8      '%3Cpre%3ESusep+Retornado%3A+', !1
         10        CONCAT                                           ~9      ~8, '%3C%2Fpre%3E'
         11        ECHO                                                     ~9
   67    12        ROPE_INIT                                     3  ~11     'https%3A%2F%2Fwwws.portoseguro.com.br%2FConsultaDadoSeguradoService%2FREST%2FobterDadosSegurado%3Fcpfcnpj%3D'
         13        ROPE_ADD                                      1  ~11     ~11, !0
         14        ROPE_END                                      2  ~10     ~11, '%26codigoProduto%3D0'
         15        ECHO                                                     ~10
         16      > RETURN                                                   1

Function checaclienteporto:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 57
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 43
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 41
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 49
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 41
Branch analysis from position: 41
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 49
Branch analysis from position: 48
Branch analysis from position: 49
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 51
Branch analysis from position: 51
2 jumps found. (Code = 107) Position 1 = 52, Position 2 = -2
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g3JZC
function name:  checaClientePorto
number of ops:  59
compiled vars:  !0 = $cnpj, !1 = $codigoProduto, !2 = $result, !3 = $obj, !4 = $corretores, !5 = $retorno, !6 = $susep, !7 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    5     2        INIT_FCALL                                               'trim'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        STRLEN                                           ~9      $8
          6        IS_SMALLER                                               0, ~9
          7      > JMPZ                                                     ~10, ->57
    9     8    >   INIT_FCALL                                               'simplexml_load_string'
          9        SEND_VAL                                                 '%3Csegurado%3E%0A%3CnomeSegurado%3EEMERSON+DA+SILVA+BRULL%3C%2FnomeSegurado%3E%0A%3CnumeroCpfCnpj%3E345769118%3C%2FnumeroCpfCnpj%3E%0A%3CordemCnpj%3E0%3C%2FordemCnpj%3E%0A%3CdigitoCpfCnpj%3E56%3C%2FdigitoCpfCnpj%3E%0A%3CstatusSegurado%3E2%3C%2FstatusSegurado%3E%0A%3Ccorretores%3E%0A%3Csusep%3E%3C%2Fsusep%3E%0A%3Csusep%3EV2064F%3C%2Fsusep%3E%0A%3Csusep%3EP5005J%3C%2Fsusep%3E%0A%3Csusep%3EP2371J%3C%2Fsusep%3E%0A%3C%2Fcorretores%3E%0A%3C%2Fsegurado%3E'
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !2, $11
   23    12        INIT_FCALL                                               'json_decode'
         13        INIT_FCALL                                               'json_encode'
         14        CAST                                          7  ~13     !2
         15        SEND_VAL                                                 ~13
         16        DO_ICALL                                         $14     
         17        SEND_VAR                                                 $14
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !3, $15
   24    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
   25    23        INIT_FCALL                                               'get_object_vars'
         24        FETCH_OBJ_R                                      ~18     !3, 'corretores'
         25        SEND_VAL                                                 ~18
         26        DO_ICALL                                         $19     
         27        ASSIGN                                                   !4, $19
   27    28        ASSIGN                                                   !5, null
   29    29        FETCH_DIM_R                                      ~22     !4, 'susep'
         30        TYPE_CHECK                                  128          ~22
         31      > JMPZ                                                     ~23, ->43
   30    32    >   FETCH_DIM_R                                      ~24     !2, 'susep'
         33      > FE_RESET_R                                       $25     ~24, ->41
         34    > > FE_FETCH_R                                               $25, !6, ->41
   32    35    >   INSTANCEOF                                       ~26     !6, 'stdClass'
         36        BOOL_NOT                                         ~27     ~26
         37      > JMPZ                                                     ~27, ->40
   33    38    >   ASSIGN                                                   !5, !6
   34    39      > JMP                                                      ->41
   30    40    > > JMP                                                      ->34
         41    >   FE_FREE                                                  $25
         42      > JMP                                                      ->46
   41    43    >   FETCH_OBJ_R                                      ~29     !2, 'corretores'
         44        FETCH_OBJ_R                                      ~30     ~29, 'susep'
         45        ASSIGN                                                   !5, ~30
   44    46    >   TYPE_CHECK                                    2          !5
         47      > JMPZ                                                     ~32, ->49
   46    48    >   ASSIGN                                                   !5, ''
   49    49    > > RETURN                                                   !5
         50*       JMP                                                      ->56
   51    51  E > > CATCH                                       last         'Exception'
   53    52    >   INIT_METHOD_CALL                                         !7, 'getMessage'
         53        DO_FCALL                                      0  $34     
         54        INIT_ARRAY                                       ~35     $34, 'erro'
         55      > RETURN                                                   ~35
         56*       JMP                                                      ->58
   58    57    > > RETURN                                                   'ERROCPF'
   60    58*     > RETURN                                                   null

End of function checaclienteporto

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.11 ms | 1406 KiB | 26 Q