3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'http://beta.congress.gov/search?pageSort=dateOfIntroduction%3Adesc&q={%22congress%22%3A%22112|113|111|110|109|108|107|106%22%2C%22source%22%3A%22legislation%22}&pageSize=25'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600); curl_setopt($ch, CURLOPT_TIMEOUT, 600); $contents = curl_exec($ch); libxml_use_internal_errors(true); $dom = new DOMDocument; $dom->loadHTML($contents); header('content-type: text/plain'); $xpath = new DOMXPath($dom); $found = $xpath->query('//ul[@class="results_list"]/li'); $results = array(); foreach ($found as $li) { $bill = $xpath->query('h2/a', $li); $bill_name = $bill->item(0)->nodeValue; $bill_url = $bill->item(0)->getAttribute('href'); $sponsor = $xpath->query('table/tbody/tr/td/a', $li); $sponsor_name = $sponsor->item(0)->nodeValue; $sponsor_url = $sponsor->item(0)->getAttribute('href'); $results[] = array( $bill_name => $bill_url, $sponsor_name => $sponsor_url ); } var_dump($results);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 73, Position 2 = 113
Branch analysis from position: 73
2 jumps found. (Code = 78) Position 1 = 74, Position 2 = 113
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
Branch analysis from position: 113
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 113
filename:       /in/THI6S
function name:  (null)
number of ops:  118
compiled vars:  !0 = $url, !1 = $ch, !2 = $contents, !3 = $dom, !4 = $xpath, !5 = $found, !6 = $results, !7 = $li, !8 = $bill, !9 = $bill_name, !10 = $bill_url, !11 = $sponsor, !12 = $sponsor_name, !13 = $sponsor_url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fbeta.congress.gov%2Fsearch%3FpageSort%3DdateOfIntroduction%253Adesc%26q%3D%7B%2522congress%2522%253A%2522112%7C113%7C111%7C110%7C109%7C108%7C107%7C106%2522%252C%2522source%2522%253A%2522legislation%2522%7D%26pageSize%3D25'
    4     1        INIT_FCALL_BY_NAME                                       'curl_init'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $15     
          4        ASSIGN                                                   !1, $15
    6     5        INIT_FCALL_BY_NAME                                       'curl_setopt'
          6        SEND_VAR_EX                                              !1
          7        FETCH_CONSTANT                                   ~17     'CURLOPT_HEADER'
          8        SEND_VAL_EX                                              ~17
          9        SEND_VAL_EX                                              1
         10        DO_FCALL                                      0          
    7    11        INIT_FCALL_BY_NAME                                       'curl_setopt'
         12        SEND_VAR_EX                                              !1
         13        FETCH_CONSTANT                                   ~19     'CURLOPT_RETURNTRANSFER'
         14        SEND_VAL_EX                                              ~19
         15        SEND_VAL_EX                                              <true>
         16        DO_FCALL                                      0          
    8    17        INIT_FCALL_BY_NAME                                       'curl_setopt'
         18        SEND_VAR_EX                                              !1
         19        FETCH_CONSTANT                                   ~21     'CURLOPT_FOLLOWLOCATION'
         20        SEND_VAL_EX                                              ~21
         21        SEND_VAL_EX                                              <true>
         22        DO_FCALL                                      0          
    9    23        INIT_FCALL_BY_NAME                                       'curl_setopt'
         24        SEND_VAR_EX                                              !1
         25        FETCH_CONSTANT                                   ~23     'CURLOPT_SSL_VERIFYPEER'
         26        SEND_VAL_EX                                              ~23
         27        SEND_VAL_EX                                              <false>
         28        DO_FCALL                                      0          
   10    29        INIT_FCALL_BY_NAME                                       'curl_setopt'
         30        SEND_VAR_EX                                              !1
         31        FETCH_CONSTANT                                   ~25     'CURLOPT_SSL_VERIFYHOST'
         32        SEND_VAL_EX                                              ~25
         33        SEND_VAL_EX                                              <false>
         34        DO_FCALL                                      0          
   11    35        INIT_FCALL_BY_NAME                                       'curl_setopt'
         36        SEND_VAR_EX                                              !1
         37        FETCH_CONSTANT                                   ~27     'CURLOPT_CONNECTTIMEOUT'
         38        SEND_VAL_EX                                              ~27
         39        SEND_VAL_EX                                              600
         40        DO_FCALL                                      0          
   12    41        INIT_FCALL_BY_NAME                                       'curl_setopt'
         42        SEND_VAR_EX                                              !1
         43        FETCH_CONSTANT                                   ~29     'CURLOPT_TIMEOUT'
         44        SEND_VAL_EX                                              ~29
         45        SEND_VAL_EX                                              600
         46        DO_FCALL                                      0          
   14    47        INIT_FCALL_BY_NAME                                       'curl_exec'
         48        SEND_VAR_EX                                              !1
         49        DO_FCALL                                      0  $31     
         50        ASSIGN                                                   !2, $31
   16    51        INIT_FCALL                                               'libxml_use_internal_errors'
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                                 
   17    54        NEW                                              $34     'DOMDocument'
         55        DO_FCALL                                      0          
         56        ASSIGN                                                   !3, $34
   18    57        INIT_METHOD_CALL                                         !3, 'loadHTML'
         58        SEND_VAR_EX                                              !2
         59        DO_FCALL                                      0          
   20    60        INIT_FCALL                                               'header'
         61        SEND_VAL                                                 'content-type%3A+text%2Fplain'
         62        DO_ICALL                                                 
   22    63        NEW                                              $39     'DOMXPath'
         64        SEND_VAR_EX                                              !3
         65        DO_FCALL                                      0          
         66        ASSIGN                                                   !4, $39
   23    67        INIT_METHOD_CALL                                         !4, 'query'
         68        SEND_VAL_EX                                              '%2F%2Ful%5B%40class%3D%22results_list%22%5D%2Fli'
         69        DO_FCALL                                      0  $42     
         70        ASSIGN                                                   !5, $42
   25    71        ASSIGN                                                   !6, <array>
   26    72      > FE_RESET_R                                       $45     !5, ->113
         73    > > FE_FETCH_R                                               $45, !7, ->113
   28    74    >   INIT_METHOD_CALL                                         !4, 'query'
         75        SEND_VAL_EX                                              'h2%2Fa'
         76        SEND_VAR_EX                                              !7
         77        DO_FCALL                                      0  $46     
         78        ASSIGN                                                   !8, $46
   29    79        INIT_METHOD_CALL                                         !8, 'item'
         80        SEND_VAL_EX                                              0
         81        DO_FCALL                                      0  $48     
         82        FETCH_OBJ_R                                      ~49     $48, 'nodeValue'
         83        ASSIGN                                                   !9, ~49
   30    84        INIT_METHOD_CALL                                         !8, 'item'
         85        SEND_VAL_EX                                              0
         86        DO_FCALL                                      0  $51     
         87        INIT_METHOD_CALL                                         $51, 'getAttribute'
         88        SEND_VAL_EX                                              'href'
         89        DO_FCALL                                      0  $52     
         90        ASSIGN                                                   !10, $52
   32    91        INIT_METHOD_CALL                                         !4, 'query'
         92        SEND_VAL_EX                                              'table%2Ftbody%2Ftr%2Ftd%2Fa'
         93        SEND_VAR_EX                                              !7
         94        DO_FCALL                                      0  $54     
         95        ASSIGN                                                   !11, $54
   33    96        INIT_METHOD_CALL                                         !11, 'item'
         97        SEND_VAL_EX                                              0
         98        DO_FCALL                                      0  $56     
         99        FETCH_OBJ_R                                      ~57     $56, 'nodeValue'
        100        ASSIGN                                                   !12, ~57
   34   101        INIT_METHOD_CALL                                         !11, 'item'
        102        SEND_VAL_EX                                              0
        103        DO_FCALL                                      0  $59     
        104        INIT_METHOD_CALL                                         $59, 'getAttribute'
        105        SEND_VAL_EX                                              'href'
        106        DO_FCALL                                      0  $60     
        107        ASSIGN                                                   !13, $60
   37   108        INIT_ARRAY                                       ~63     !10, !9
   38   109        ADD_ARRAY_ELEMENT                                ~63     !13, !12
   36   110        ASSIGN_DIM                                               !6
   38   111        OP_DATA                                                  ~63
   26   112      > JMP                                                      ->73
        113    >   FE_FREE                                                  $45
   42   114        INIT_FCALL                                               'var_dump'
        115        SEND_VAR                                                 !6
        116        DO_ICALL                                                 
        117      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.1 ms | 1404 KiB | 19 Q