Hi!
I want to create a link which automatically checks, which webserver listens behind a specific IP adress.
As you all know you can find out the webserver name by telnet-ing port 80 on the target machine. Thats what my PHP-script should do, and give me back the output (so that I can scan the output for the "Server:" line).
Unfortunetly I cant get the telnet output. If you have tried getting the server information via telnet you know that you have to hit <enter> once or twice to get something displayed in your commandline. Like:
telnet localhost 80
GET / HTTP/1.1 (you dont see what you are typing, but it works)
<enter><enter><enter>
Ok, now I tried to get this output to my var:
$output = shell_exec('telnet localhost 80 && "GET / HTTP/1.1\r\n"');
echo $output;
Unfortunetly that does not work. I guess it is because of the not-ending telnet session I normally quit with hitting <enter>. I tried to use "\r" and "\n" instead ... or
telnet localhost 80 && "GET / HTTP/1.1\r\n" && quit
but nothing worked. Do you have any idea ?
Many thanks for reading,
Reiners