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"; } ?>
Output for git.master, git.master_jit, rfc.property-hooks
<h2>TCP/IP Connection</h2> Fatal error: Uncaught Error: Call to undefined function socket_create() in /in/hA0hJ:36 Stack trace: #0 {main} thrown in /in/hA0hJ on line 36
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.53 ms | 401 KiB | 8 Q