0

EDIT:

I want to telnet into my web server on localhost, and request my php file from command line:

I have:

1) cd'd into the directory I want to serve, namely "/www" (hello.php is here)

2) run a server at directory www: python -m SimpleHTTPServer

3) telnet localhost 80

but "connection is refused". what am I doing wrong?

8-Bit Borges
  • 9,643
  • 29
  • 101
  • 198
  • possible duplicate of [How to send an HTTP request using Telnet](http://stackoverflow.com/questions/15772355/how-to-send-an-http-request-using-telnet) – metatoaster Sep 16 '15 at 04:16
  • 1
    im confused as what you want to achieve. –  Sep 16 '15 at 04:23
  • @metatoaster where http request on this question? Don't write google result ! Yes ! but, if a service run on in a thread, when thread is ended service will be stop or freeze. you want serve forever, need set as local service and use via control script. But don't forget you require a strong threading manager for all security bug.. – dsgdfg Sep 16 '15 at 04:53
  • @data-garden your page a `PHP`, how to serve it with python ? – dsgdfg Sep 16 '15 at 05:00
  • @dsgdfg how do I serve it then? – 8-Bit Borges Sep 16 '15 at 05:54
  • [here smilar question](http://stackoverflow.com/questions/12235876/python-simplehttpserver-with-php) try on console check if is work. @data_garden – dsgdfg Sep 16 '15 at 07:36

2 Answers2

0

You're probably trying to connect to a wrong port. Check with netstat -lntp which port is your http server listening on. The process will be listed as python/pid_number.

viraptor
  • 33,322
  • 10
  • 107
  • 191
-2

If you're using Linux then try this:

$ telnet localhost 80
GET /hello.php