3v4l.org

run code in 300+ PHP versions simultaneously
<?php function curl_download($Url){ // is cURL installed yet? if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); } // OK cool - then let's create a new cURL resource handle $ch = curl_init(); // Now set some options (most are optional) // Set URL to download curl_setopt($ch, CURLOPT_URL, $Url); // Set a referer curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm"); // User agent curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); // Include header in result? (0 = yes, 1 = no) curl_setopt($ch, CURLOPT_HEADER, 0); // Should cURL return or print out the data? (true = return, false = print) curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Timeout in seconds curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Download the given URL, and return output $output = curl_exec($ch); // Close the cURL resource, and free system resources curl_close($ch); return $output; } print curl_download('http://www.example.org/');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bWp9r
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   INIT_FCALL                                               'curl_download'
          1        SEND_VAL                                                 'http%3A%2F%2Fwww.example.org%2F'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function curl_download:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bWp9r
function name:  curl_download
number of ops:  55
compiled vars:  !0 = $Url, !1 = $ch, !2 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'function_exists'
          2        SEND_VAL                                                 'curl_init'
          3        DO_ICALL                                         $3      
          4        BOOL_NOT                                         ~4      $3
          5      > JMPZ                                                     ~4, ->7
    7     6    > > EXIT                                                     'Sorry+cURL+is+not+installed%21'
   11     7    >   INIT_FCALL_BY_NAME                                       'curl_init'
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !1, $5
   16    10        INIT_FCALL_BY_NAME                                       'curl_setopt'
         11        SEND_VAR_EX                                              !1
         12        FETCH_CONSTANT                                   ~7      'CURLOPT_URL'
         13        SEND_VAL_EX                                              ~7
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   19    16        INIT_FCALL_BY_NAME                                       'curl_setopt'
         17        SEND_VAR_EX                                              !1
         18        FETCH_CONSTANT                                   ~9      'CURLOPT_REFERER'
         19        SEND_VAL_EX                                              ~9
         20        SEND_VAL_EX                                              'http%3A%2F%2Fwww.example.org%2Fyay.htm'
         21        DO_FCALL                                      0          
   22    22        INIT_FCALL_BY_NAME                                       'curl_setopt'
         23        SEND_VAR_EX                                              !1
         24        FETCH_CONSTANT                                   ~11     'CURLOPT_USERAGENT'
         25        SEND_VAL_EX                                              ~11
         26        SEND_VAL_EX                                              'MozillaXYZ%2F1.0'
         27        DO_FCALL                                      0          
   25    28        INIT_FCALL_BY_NAME                                       'curl_setopt'
         29        SEND_VAR_EX                                              !1
         30        FETCH_CONSTANT                                   ~13     'CURLOPT_HEADER'
         31        SEND_VAL_EX                                              ~13
         32        SEND_VAL_EX                                              0
         33        DO_FCALL                                      0          
   28    34        INIT_FCALL_BY_NAME                                       'curl_setopt'
         35        SEND_VAR_EX                                              !1
         36        FETCH_CONSTANT                                   ~15     'CURLOPT_RETURNTRANSFER'
         37        SEND_VAL_EX                                              ~15
         38        SEND_VAL_EX                                              <true>
         39        DO_FCALL                                      0          
   31    40        INIT_FCALL_BY_NAME                                       'curl_setopt'
         41        SEND_VAR_EX                                              !1
         42        FETCH_CONSTANT                                   ~17     'CURLOPT_TIMEOUT'
         43        SEND_VAL_EX                                              ~17
         44        SEND_VAL_EX                                              10
         45        DO_FCALL                                      0          
   34    46        INIT_FCALL_BY_NAME                                       'curl_exec'
         47        SEND_VAR_EX                                              !1
         48        DO_FCALL                                      0  $19     
         49        ASSIGN                                                   !2, $19
   37    50        INIT_FCALL_BY_NAME                                       'curl_close'
         51        SEND_VAR_EX                                              !1
         52        DO_FCALL                                      0          
   39    53      > RETURN                                                   !2
   40    54*     > RETURN                                                   null

End of function curl_download

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.96 ms | 1403 KiB | 16 Q