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_file($filename); $obj = json_decode(json_encode((array) $result)); $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 = $_REQUEST['cpf']; echo "CPF: $cpf<br/>"; $res=checaClientePorto('34576911856'); 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/SJcET
function name:  (null)
number of ops:  19
compiled vars:  !0 = $cpf, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   FETCH_R                      global              ~2      '_REQUEST'
          1        FETCH_DIM_R                                      ~3      ~2, 'cpf'
          2        ASSIGN                                                   !0, ~3
   51     3        ROPE_INIT                                     3  ~6      'CPF%3A+'
          4        ROPE_ADD                                      1  ~6      ~6, !0
          5        ROPE_END                                      2  ~5      ~6, '%3Cbr%2F%3E'
          6        ECHO                                                     ~5
   52     7        INIT_FCALL                                               'checaclienteporto'
          8        SEND_VAL                                                 '34576911856'
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !1, $8
   53    11        CONCAT                                           ~10     '%3Cpre%3ESusep+Retornado%3A+', !1
         12        CONCAT                                           ~11     ~10, '%3C%2Fpre%3E'
         13        ECHO                                                     ~11
   54    14        ROPE_INIT                                     3  ~13     'https%3A%2F%2Fwwws.portoseguro.com.br%2FConsultaDadoSeguradoService%2FREST%2FobterDadosSegurado%3Fcpfcnpj%3D'
         15        ROPE_ADD                                      1  ~13     ~13, !0
         16        ROPE_END                                      2  ~12     ~13, '%26codigoProduto%3D0'
         17        ECHO                                                     ~12
         18      > RETURN                                                   1

Function checaclienteporto:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 59
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 45
Branch analysis from position: 34
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 43
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 43
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 43
Branch analysis from position: 43
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
Branch analysis from position: 51
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 53
Branch analysis from position: 53
2 jumps found. (Code = 107) Position 1 = 54, Position 2 = -2
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SJcET
function name:  checaClientePorto
number of ops:  61
compiled vars:  !0 = $cnpj, !1 = $codigoProduto, !2 = $filename, !3 = $result, !4 = $obj, !5 = $corretores, !6 = $retorno, !7 = $susep, !8 = $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                                         $9      
          5        STRLEN                                           ~10     $9
          6        IS_SMALLER                                               0, ~10
          7      > JMPZ                                                     ~11, ->59
    7     8    >   ROPE_INIT                                     4  ~13     'https%3A%2F%2Fwwws.portoseguro.com.br%2FConsultaDadoSeguradoService%2FREST%2FobterDadosSegurado%3Fcpfcnpj%3D'
          9        ROPE_ADD                                      1  ~13     ~13, !0
         10        ROPE_ADD                                      2  ~13     ~13, '%26codigoProduto%3D'
         11        ROPE_END                                      3  ~12     ~13, !1
         12        ASSIGN                                                   !2, ~12
    9    13        INIT_FCALL                                               'simplexml_load_file'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $16     
         16        ASSIGN                                                   !3, $16
   11    17        INIT_FCALL                                               'json_decode'
         18        INIT_FCALL                                               'json_encode'
         19        CAST                                          7  ~18     !3
         20        SEND_VAL                                                 ~18
         21        DO_ICALL                                         $19     
         22        SEND_VAR                                                 $19
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !4, $20
   12    25        INIT_FCALL                                               'get_object_vars'
         26        FETCH_OBJ_R                                      ~22     !4, 'corretores'
         27        SEND_VAL                                                 ~22
         28        DO_ICALL                                         $23     
         29        ASSIGN                                                   !5, $23
   14    30        ASSIGN                                                   !6, null
   16    31        FETCH_DIM_R                                      ~26     !5, 'susep'
         32        TYPE_CHECK                                  128          ~26
         33      > JMPZ                                                     ~27, ->45
   17    34    >   FETCH_DIM_R                                      ~28     !3, 'susep'
         35      > FE_RESET_R                                       $29     ~28, ->43
         36    > > FE_FETCH_R                                               $29, !7, ->43
   19    37    >   INSTANCEOF                                       ~30     !7, 'stdClass'
         38        BOOL_NOT                                         ~31     ~30
         39      > JMPZ                                                     ~31, ->42
   20    40    >   ASSIGN                                                   !6, !7
   21    41      > JMP                                                      ->43
   17    42    > > JMP                                                      ->36
         43    >   FE_FREE                                                  $29
         44      > JMP                                                      ->48
   28    45    >   FETCH_OBJ_R                                      ~33     !3, 'corretores'
         46        FETCH_OBJ_R                                      ~34     ~33, 'susep'
         47        ASSIGN                                                   !6, ~34
   31    48    >   TYPE_CHECK                                    2          !6
         49      > JMPZ                                                     ~36, ->51
   33    50    >   ASSIGN                                                   !6, ''
   36    51    > > RETURN                                                   !6
         52*       JMP                                                      ->58
   38    53  E > > CATCH                                       last         'Exception'
   40    54    >   INIT_METHOD_CALL                                         !8, 'getMessage'
         55        DO_FCALL                                      0  $38     
         56        INIT_ARRAY                                       ~39     $38, 'erro'
         57      > RETURN                                                   ~39
         58*       JMP                                                      ->60
   45    59    > > RETURN                                                   'ERROCPF'
   47    60*     > RETURN                                                   null

End of function checaclienteporto

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.45 ms | 1398 KiB | 24 Q