3v4l.org

run code in 300+ PHP versions simultaneously
<?php include_once("simple_html_dom.php"); //use curl to get html content 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.website.com",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 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 15
filename:       /in/LPka9
function name:  (null)
number of ops:  27
compiled vars:  !0 = $html, !1 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INCLUDE_OR_EVAL                                          'simple_html_dom.php', INCLUDE_ONCE
   14     1        INIT_FCALL                                               'gethtml'
          2        SEND_VAL                                                 'http%3A%2F%2Fwww.website.com'
          3        SEND_VAL                                                 10
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
   16     6        INIT_METHOD_CALL                                         !0, 'find'
          7        SEND_VAL_EX                                              'img'
          8        DO_FCALL                                      0  $5      
          9      > FE_RESET_R                                       $6      $5, ->15
         10    > > FE_FETCH_R                                               $6, !1, ->15
   17    11    >   FETCH_OBJ_R                                      ~7      !1, 'src'
         12        CONCAT                                           ~8      ~7, '%3Cbr%3E'
         13        ECHO                                                     ~8
   16    14      > JMP                                                      ->10
         15    >   FE_FREE                                                  $6
   20    16        INIT_METHOD_CALL                                         !0, 'find'
         17        SEND_VAL_EX                                              'a'
         18        DO_FCALL                                      0  $9      
         19      > FE_RESET_R                                       $10     $9, ->25
         20    > > FE_FETCH_R                                               $10, !1, ->25
   21    21    >   FETCH_OBJ_R                                      ~11     !1, 'href'
         22        CONCAT                                           ~12     ~11, '%3Cbr%3E'
         23        ECHO                                                     ~12
   20    24      > JMP                                                      ->20
         25    >   FE_FREE                                                  $10
   21    26      > RETURN                                                   1

Function gethtml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LPka9
function name:  getHTML
number of ops:  46
compiled vars:  !0 = $url, !1 = $timeout, !2 = $ch
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL_BY_NAME                                       'curl_init'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !2, $3
    7     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          
    8    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          
    9    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          
   10    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          
   11    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          
   12    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
   13    45*     > RETURN                                                   null

End of function gethtml

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.19 ms | 1403 KiB | 14 Q