-
-
Save ash-m/e5cfd1b53fc72749f254b68995b52413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ashm@laptop:~$ cat <<-'EOF' > script.php | |
> <?php | |
echo "* hello\n"; | |
$fp = fsockopen('127.0.0.1', 8080, $errno, $errstr, 3); | |
if (!$fp) { | |
echo "$errstr ($errno)<br />\n"; | |
} else { | |
$out = "GET / HTTP/1.1\r\n"; | |
$out .= "Host: 127.0.0.1:8080\r\n"; | |
$out .= "Connection: Close\r\n\r\n"; | |
fwrite($fp, $out); | |
while (!feof($fp)) { | |
echo fgets($fp, 128); | |
} | |
fclose($fp); | |
} | |
> EOF | |
ashm@laptop:~$ cat <<-'EOF' > remote.php | |
<?php | |
echo "* received\n"; | |
EOF | |
ashm@laptop:~$ php -S 127.0.0.1:8081 script.php &>> /tmp/script.log & | |
[1] 92421 | |
ashm@laptop:~$ php -S 127.0.0.1:8080 remote.php &>> /tmp/remote.log & | |
[2] 92429 | |
ashm@laptop:~$ curl -sv 127.0.0.1:8080 | |
* Trying 127.0.0.1:8080... | |
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) | |
> GET / HTTP/1.1 | |
> Host: 127.0.0.1:8080 | |
> User-Agent: curl/7.81.0 | |
> Accept: */* | |
> | |
* Mark bundle as not supporting multiuse | |
< HTTP/1.1 200 OK | |
< Host: 127.0.0.1:8080 | |
< Date: Fri, 09 Dec 2022 23:25:01 GMT | |
< Connection: close | |
< X-Powered-By: PHP/8.0.24 | |
< Content-type: text/html; charset=UTF-8 | |
< | |
* received | |
* Closing connection 0 | |
ashm@laptop:~$ curl -sv 127.0.0.1:8081 | |
* Trying 127.0.0.1:8081... | |
* Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0) | |
> GET / HTTP/1.1 | |
> Host: 127.0.0.1:8081 | |
> User-Agent: curl/7.81.0 | |
> Accept: */* | |
> | |
* Mark bundle as not supporting multiuse | |
< HTTP/1.1 200 OK | |
< Host: 127.0.0.1:8081 | |
< Date: Fri, 09 Dec 2022 23:25:08 GMT | |
< Connection: close | |
< X-Powered-By: PHP/8.0.24 | |
< Content-type: text/html; charset=UTF-8 | |
< | |
* Closing connection 0 | |
ashm@laptop:~$ | |
ashm@laptop:~$ | |
ashm@laptop:~$ | |
ashm@laptop:~$ tail -n +1 /tmp/script.log /tmp/remote.log | |
==> /tmp/script.log <== | |
[Fri Dec 9 16:24:33 2022] PHP 8.0.24 Development Server (http://127.0.0.1:8081) started | |
[Fri Dec 9 16:25:08 2022] 127.0.0.1:39390 Accepted | |
[Fri Dec 9 16:25:08 2022] 127.0.0.1:39390 Closing | |
==> /tmp/remote.log <== | |
[Fri Dec 9 16:24:43 2022] PHP 8.0.24 Development Server (http://127.0.0.1:8080) started | |
[Fri Dec 9 16:25:01 2022] 127.0.0.1:43246 Accepted | |
[Fri Dec 9 16:25:01 2022] 127.0.0.1:43246 Closing | |
ashm@laptop:~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment