3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getHTML($url,$timeout) { $ch = curl_init($url); // initialize curl with given url curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); // set useragent 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_CONNECTTIMEOUT, $timeout); // max. seconds to execute curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error return @curl_exec($ch); } $html=getHTML("http://www.http://dict.leo.org",10); // Find all images on webpage foreach($html->find("img") as $element) echo $element->src . '<br>'; // Find all links on webpage foreach($html->find("a") as $element) echo $element->href . '<br>'; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 14
filename:       /in/CfpZl
function name:  (null)
number of ops:  26
compiled vars:  !0 = $html, !1 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'gethtml'
          1        SEND_VAL                                                 'http%3A%2F%2Fwww.http%3A%2F%2Fdict.leo.org'
          2        SEND_VAL                                                 10
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   15     5        INIT_METHOD_CALL                                         !0, 'find'
          6        SEND_VAL_EX                                              'img'
          7        DO_FCALL                                      0  $4      
          8      > FE_RESET_R                                       $5      $4, ->14
          9    > > FE_FETCH_R                                               $5, !1, ->14
   16    10    >   FETCH_OBJ_R                                      ~6      !1, 'src'
         11        CONCAT                                           ~7      ~6, '%3Cbr%3E'
         12        ECHO                                                     ~7
   15    13      > JMP                                                      ->9
         14    >   FE_FREE                                                  $5
   19    15        INIT_METHOD_CALL                                         !0, 'find'
         16        SEND_VAL_EX                                              'a'
         17        DO_FCALL                                      0  $8      
         18      > FE_RESET_R                                       $9      $8, ->24
         19    > > FE_FETCH_R                                               $9, !1, ->24
   20    20    >   FETCH_OBJ_R                                      ~10     !1, 'href'
         21        CONCAT                                           ~11     ~10, '%3Cbr%3E'
         22        ECHO                                                     ~11
   19    23      > JMP                                                      ->19
         24    >   FE_FREE                                                  $9
   21    25      > RETURN                                                   1

Function gethtml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfpZl
function name:  getHTML
number of ops:  46
compiled vars:  !0 = $url, !1 = $timeout, !2 = $ch
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL_BY_NAME                                       'curl_init'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !2, $3
    6     6        INIT_FCALL_BY_NAME                                       'curl_setopt'
          7        SEND_VAR_EX                                              !2
          8        FETCH_CONSTANT                                   ~5      'CURLOPT_USERAGENT'
          9        SEND_VAL_EX                                              ~5
         10        CHECK_FUNC_ARG                                           
         11        FETCH_FUNC_ARG               global              $6      '_SERVER'
         12        FETCH_DIM_FUNC_ARG                               $7      $6, 'HTTP_USER_AGENT'
         13        SEND_FUNC_ARG                                            $7
         14        DO_FCALL                                      0          
    7    15        INIT_FCALL_BY_NAME                                       'curl_setopt'
         16        SEND_VAR_EX                                              !2
         17        FETCH_CONSTANT                                   ~9      'CURLOPT_RETURNTRANSFER'
         18        SEND_VAL_EX                                              ~9
         19        SEND_VAL_EX                                              <true>
         20        DO_FCALL                                      0          
    8    21        INIT_FCALL_BY_NAME                                       'curl_setopt'
         22        SEND_VAR_EX                                              !2
         23        FETCH_CONSTANT                                   ~11     'CURLOPT_FOLLOWLOCATION'
         24        SEND_VAL_EX                                              ~11
         25        SEND_VAL_EX                                              <true>
         26        DO_FCALL                                      0          
    9    27        INIT_FCALL_BY_NAME                                       'curl_setopt'
         28        SEND_VAR_EX                                              !2
         29        FETCH_CONSTANT                                   ~13     'CURLOPT_CONNECTTIMEOUT'
         30        SEND_VAL_EX                                              ~13
         31        SEND_VAR_EX                                              !1
         32        DO_FCALL                                      0          
   10    33        INIT_FCALL_BY_NAME                                       'curl_setopt'
         34        SEND_VAR_EX                                              !2
         35        FETCH_CONSTANT                                   ~15     'CURLOPT_FAILONERROR'
         36        SEND_VAL_EX                                              ~15
         37        SEND_VAL_EX                                              1
         38        DO_FCALL                                      0          
   11    39        BEGIN_SILENCE                                    ~17     
         40        INIT_FCALL_BY_NAME                                       'curl_exec'
         41        SEND_VAR_EX                                              !2
         42        DO_FCALL                                      0  $18     
         43        END_SILENCE                                              ~17
         44      > RETURN                                                   $18
   12    45*     > RETURN                                                   null

End of function gethtml

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.53 ms | 1403 KiB | 14 Q