3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = grab_content('http://www.metano-logistics.com/metano_olm/assets/view_asset.php?id=17876&page_mode=2009'); $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXPath($dom); $results = $xpath->query("//div[@class='tabbed_container']"); $content_array = array(); if ($results->length > 0) { $dom->saveXML($results->item(0)); //exit; for($i=0;$i<5;$i++){ $content_array[] = $dom->saveXML($results->item($i)); } } function grab_content($url){ $ch = curl_init(); $timeout = 50; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); print_r($data); return $data; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 41
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 30
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 30
Branch analysis from position: 41
Branch analysis from position: 30
Branch analysis from position: 41
filename:       /in/vUa88
function name:  (null)
number of ops:  42
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath, !3 = $results, !4 = $content_array, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                       'grab_content'
          1        SEND_VAL_EX                                              'http%3A%2F%2Fwww.metano-logistics.com%2Fmetano_olm%2Fassets%2Fview_asset.php%3Fid%3D17876%26page_mode%3D2009'
          2        DO_FCALL                                      0  $6      
          3        ASSIGN                                                   !0, $6
    4     4        NEW                                              $8      'DOMDocument'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $8
    5     7        INIT_METHOD_CALL                                         !1, 'loadHTML'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
    6    10        NEW                                              $12     'DOMXPath'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $12
    7    14        INIT_METHOD_CALL                                         !2, 'query'
         15        SEND_VAL_EX                                              '%2F%2Fdiv%5B%40class%3D%27tabbed_container%27%5D'
         16        DO_FCALL                                      0  $15     
         17        ASSIGN                                                   !3, $15
    9    18        ASSIGN                                                   !4, <array>
   11    19        FETCH_OBJ_R                                      ~18     !3, 'length'
         20        IS_SMALLER                                               0, ~18
         21      > JMPZ                                                     ~19, ->41
   13    22    >   INIT_METHOD_CALL                                         !1, 'saveXML'
         23        INIT_METHOD_CALL                                         !3, 'item'
         24        SEND_VAL_EX                                              0
         25        DO_FCALL                                      0  $20     
         26        SEND_VAR_NO_REF_EX                                       $20
         27        DO_FCALL                                      0          
   15    28        ASSIGN                                                   !5, 0
         29      > JMP                                                      ->39
   16    30    >   INIT_METHOD_CALL                                         !1, 'saveXML'
         31        INIT_METHOD_CALL                                         !3, 'item'
         32        SEND_VAR_EX                                              !5
         33        DO_FCALL                                      0  $24     
         34        SEND_VAR_NO_REF_EX                                       $24
         35        DO_FCALL                                      0  $25     
         36        ASSIGN_DIM                                               !4
         37        OP_DATA                                                  $25
   15    38        PRE_INC                                                  !5
         39    >   IS_SMALLER                                               !5, 5
         40      > JMPNZ                                                    ~27, ->30
   35    41    > > RETURN                                                   1

Function grab_content:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vUa88
function name:  grab_content
number of ops:  35
compiled vars:  !0 = $url, !1 = $ch, !2 = $timeout, !3 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   25     1        INIT_FCALL_BY_NAME                                       'curl_init'
          2        DO_FCALL                                      0  $4      
          3        ASSIGN                                                   !1, $4
   26     4        ASSIGN                                                   !2, 50
   27     5        INIT_FCALL_BY_NAME                                       'curl_setopt'
          6        SEND_VAR_EX                                              !1
          7        FETCH_CONSTANT                                   ~7      'CURLOPT_URL'
          8        SEND_VAL_EX                                              ~7
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   28    11        INIT_FCALL_BY_NAME                                       'curl_setopt'
         12        SEND_VAR_EX                                              !1
         13        FETCH_CONSTANT                                   ~9      'CURLOPT_RETURNTRANSFER'
         14        SEND_VAL_EX                                              ~9
         15        SEND_VAL_EX                                              1
         16        DO_FCALL                                      0          
   29    17        INIT_FCALL_BY_NAME                                       'curl_setopt'
         18        SEND_VAR_EX                                              !1
         19        FETCH_CONSTANT                                   ~11     'CURLOPT_CONNECTTIMEOUT'
         20        SEND_VAL_EX                                              ~11
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0          
   30    23        INIT_FCALL_BY_NAME                                       'curl_exec'
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0  $13     
         26        ASSIGN                                                   !3, $13
   31    27        INIT_FCALL_BY_NAME                                       'curl_close'
         28        SEND_VAR_EX                                              !1
         29        DO_FCALL                                      0          
   33    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                                 
   34    33      > RETURN                                                   !3
   35    34*     > RETURN                                                   null

End of function grab_content

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.11 ms | 1400 KiB | 15 Q