3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* $fp = fsockopen("www.independenttrucks.com", 80, $errno, $errstr, 30); socket_set_option($fp, SOL_SOCKET, SO_SNDBUF, 1); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { fwrite($fp, "GET / HTTP/1.1\r\nHost:www.independenttrucks.com\r\nUser-Agent:Mozilla 5.0\r\n\r\n"); while (!feof($fp)) { echo fgets($fp, 100); } fclose($fp); } echo "DOne" */ while (True) { error_reporting(E_ALL); echo "<h2>TCP/IP Connection</h2>\n"; /* Get the port for the WWW service. */ $service_port = getservbyname('www', 'tcp'); /* Get the IP address for the target host. */ $address = gethostbyname('elearning.delasalle.vic.edu.au'); #$address = gethostbyname('www.google.com'); #$address = gethostbyname('www.independenttrucks.com'); /* Create a TCP/IP socket. */ $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_set_option($socket, SOL_SOCKET, SO_SNDBUF, 1); if ($socket === false) { echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"; } else { echo "OK.\n"; } echo "Attempting to connect to '$address' on port '$service_port'..."; $result = socket_connect($socket, $address, $service_port); if ($result === false) { echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n"; } else { echo "OK.\n"; } $in = "GET /moodle/login/index.php HTTP/1.1\r\n"; #$in = "GET / HTTP/1.1\r\n"; $in .= "Host:elearning.delasalle.vic.edu.au\r\n"; #$in .= "Host:www.independenttrucks.com\r\n"; $in .= "User-Agent:Mozilla 5.0\r\n\r\n"; $out = ''; echo "Sending HTTP GET request..."; socket_write($socket, $in, strlen($in)); echo "OK.\n"; echo "Reading response:\n\n"; while ($out = socket_read($socket, 10000)) { echo $out; } echo "\nClosing socket..."; socket_close($socket); echo "OK.\n\n"; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 97
Branch analysis from position: 97
2 jumps found. (Code = 44) Position 1 = 98, Position 2 = 1
Branch analysis from position: 98
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 1
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 42
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 70
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 85
Branch analysis from position: 92
2 jumps found. (Code = 44) Position 1 = 98, Position 2 = 1
Branch analysis from position: 98
Branch analysis from position: 1
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 85
Branch analysis from position: 92
Branch analysis from position: 85
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 70
Branch analysis from position: 57
Branch analysis from position: 70
filename:       /in/hA0hJ
function name:  (null)
number of ops:  99
compiled vars:  !0 = $service_port, !1 = $address, !2 = $socket, !3 = $result, !4 = $in, !5 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > JMP                                                      ->97
   21     1    >   INIT_FCALL                                               'error_reporting'
          2        SEND_VAL                                                 32767
          3        DO_ICALL                                                 
   23     4        ECHO                                                     '%3Ch2%3ETCP%2FIP+Connection%3C%2Fh2%3E%0A'
   27     5        INIT_FCALL                                               'getservbyname'
          6        SEND_VAL                                                 'www'
          7        SEND_VAL                                                 'tcp'
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !0, $7
   30    10        INIT_FCALL                                               'gethostbyname'
         11        SEND_VAL                                                 'elearning.delasalle.vic.edu.au'
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !1, $9
   36    14        INIT_FCALL_BY_NAME                                       'socket_create'
         15        FETCH_CONSTANT                                   ~11     'AF_INET'
         16        SEND_VAL_EX                                              ~11
         17        FETCH_CONSTANT                                   ~12     'SOCK_STREAM'
         18        SEND_VAL_EX                                              ~12
         19        FETCH_CONSTANT                                   ~13     'SOL_TCP'
         20        SEND_VAL_EX                                              ~13
         21        DO_FCALL                                      0  $14     
         22        ASSIGN                                                   !2, $14
   37    23        INIT_FCALL_BY_NAME                                       'socket_set_option'
         24        SEND_VAR_EX                                              !2
         25        FETCH_CONSTANT                                   ~16     'SOL_SOCKET'
         26        SEND_VAL_EX                                              ~16
         27        FETCH_CONSTANT                                   ~17     'SO_SNDBUF'
         28        SEND_VAL_EX                                              ~17
         29        SEND_VAL_EX                                              1
         30        DO_FCALL                                      0          
   38    31        TYPE_CHECK                                    4          !2
         32      > JMPZ                                                     ~19, ->42
   39    33    >   INIT_FCALL_BY_NAME                                       'socket_strerror'
         34        INIT_FCALL_BY_NAME                                       'socket_last_error'
         35        DO_FCALL                                      0  $20     
         36        SEND_VAR_NO_REF_EX                                       $20
         37        DO_FCALL                                      0  $21     
         38        CONCAT                                           ~22     'socket_create%28%29+failed%3A+reason%3A+', $21
         39        CONCAT                                           ~23     ~22, '%0A'
         40        ECHO                                                     ~23
         41      > JMP                                                      ->43
   41    42    >   ECHO                                                     'OK.%0A'
   44    43    >   ROPE_INIT                                     5  ~25     'Attempting+to+connect+to+%27'
         44        ROPE_ADD                                      1  ~25     ~25, !1
         45        ROPE_ADD                                      2  ~25     ~25, '%27+on+port+%27'
         46        ROPE_ADD                                      3  ~25     ~25, !0
         47        ROPE_END                                      4  ~24     ~25, '%27...'
         48        ECHO                                                     ~24
   45    49        INIT_FCALL_BY_NAME                                       'socket_connect'
         50        SEND_VAR_EX                                              !2
         51        SEND_VAR_EX                                              !1
         52        SEND_VAR_EX                                              !0
         53        DO_FCALL                                      0  $28     
         54        ASSIGN                                                   !3, $28
   46    55        TYPE_CHECK                                    4          !3
         56      > JMPZ                                                     ~30, ->70
   47    57    >   ROPE_INIT                                     3  ~32     'socket_connect%28%29+failed.%0AReason%3A+%28'
         58        ROPE_ADD                                      1  ~32     ~32, !3
         59        ROPE_END                                      2  ~31     ~32, '%29+'
         60        INIT_FCALL_BY_NAME                                       'socket_strerror'
         61        INIT_FCALL_BY_NAME                                       'socket_last_error'
         62        SEND_VAR_EX                                              !2
         63        DO_FCALL                                      0  $34     
         64        SEND_VAR_NO_REF_EX                                       $34
         65        DO_FCALL                                      0  $35     
         66        CONCAT                                           ~36     ~31, $35
         67        CONCAT                                           ~37     ~36, '%0A'
         68        ECHO                                                     ~37
         69      > JMP                                                      ->71
   49    70    >   ECHO                                                     'OK.%0A'
   52    71    >   ASSIGN                                                   !4, 'GET+%2Fmoodle%2Flogin%2Findex.php+HTTP%2F1.1%0D%0A'
   54    72        ASSIGN_OP                                     8          !4, 'Host%3Aelearning.delasalle.vic.edu.au%0D%0A'
   56    73        ASSIGN_OP                                     8          !4, 'User-Agent%3AMozilla+5.0%0D%0A%0D%0A'
   57    74        ASSIGN                                                   !5, ''
   59    75        ECHO                                                     'Sending+HTTP+GET+request...'
   62    76        INIT_FCALL_BY_NAME                                       'socket_write'
         77        SEND_VAR_EX                                              !2
         78        SEND_VAR_EX                                              !4
         79        STRLEN                                           ~42     !4
         80        SEND_VAL_EX                                              ~42
         81        DO_FCALL                                      0          
   63    82        ECHO                                                     'OK.%0A'
   66    83        ECHO                                                     'Reading+response%3A%0A%0A'
   67    84      > JMP                                                      ->86
   68    85    >   ECHO                                                     !5
   67    86    >   INIT_FCALL_BY_NAME                                       'socket_read'
         87        SEND_VAR_EX                                              !2
         88        SEND_VAL_EX                                              10000
         89        DO_FCALL                                      0  $44     
         90        ASSIGN                                           ~45     !5, $44
         91      > JMPNZ                                                    ~45, ->85
   71    92    >   ECHO                                                     '%0AClosing+socket...'
   72    93        INIT_FCALL_BY_NAME                                       'socket_close'
         94        SEND_VAR_EX                                              !2
         95        DO_FCALL                                      0          
   73    96        ECHO                                                     'OK.%0A%0A'
   17    97    > > JMPNZ                                                    <true>, ->1
   78    98    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.3 ms | 1404 KiB | 19 Q