cbarnett at crossbeam dot com
08-Jul-2000 11:22
I'm copying this note from a post I found on Geocrawler. I think Thierry
diserves a round of applause for actually posting something useful,
so...
HooRah!!!!
I'm going to add some syntax
highlighting to the code to make it cute, and then we'll
see.
FROM: Thierry Boudet
DATE: 12/01/1998
01:35:21
SUBJECT: RE: [PHP3] [php3] get the debug
info
Rui Barreiros a 閏rit:
>
> how can i get the debug info that
the php3 sends to port 2000 (in my
> case)
>
=====================================================================
#!/usr/bin/perl -w
use Socket;
$port = 7869; # PHP debugger
my $proto
= getprotobyname('tcp');
socket(Server, PF_INET,
SOCK_STREAM, $proto)
or die
"socket: $!";
setsockopt(Server, SOL_SOCKET,
SO_REUSEADDR, pack("l",1))
or die "setsockopt: $!";
bind(Server,
sockaddr_in($port, INADDR_ANY))
or die "bind: $!";
listen(Server,
SOMAXCONN);
for ( ; $paddr = accept(Client, Server);
close Client)
{
my ($port,
$iaddr) = sockaddr_in($paddr);
my $name =
gethostbyaddr($iaddr, AF_INET);
print
"------------- $name $port --------";
while (<Client>) { print; }
}
=====================================================================