Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools HTTP Basics Introduction to HTTP Sending Data with a GET Request

Keep getting "command not found" when sending data with get request.

After following the example for sending data with a get request i keep running in the same problem.

telnet httpbin.org 80 GET /get?firstname=Chris&language=English HTTP /1.1 host:httpbin.org

However i get "command not found" or closed by foreign host. so i am totally stuck. any help would be great.

4 Answers

Connection closed is probably because you aren't typing it in fast enough. You probably only have 20-30 seconds to type in the GET /get ... before the connection is closed.

Where are you running telnet? If on your local computer, you might not have it installed. That is why it says "command not found".

If on the workspace, then you have to press "Enter" 2 times after typing "host: httpbin.org".

treehouse: ~/workspace$ telnet httpbin.org 80
Trying 54.175.219.8...
Connected to httpbin.org.
Escape character is '^]'.
GET /get?firstname=John&language=English HTTP/1.1
host: httpbin.org

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 01 Apr 2016 19:20:18 GMT
Content-Type: application/json
Content-Length: 219
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

{
  "args": {
    "firstname": "John",
    "language": "English"
  },
  "headers": {
    "Host": "httpbin.org"
  },
  "origin": "0.0.0.0",
  "url": "http://httpbin.org/get?firstname=John&language=English"
}

Hi there i am using the workspace but when i click the first time i get hosConnection closed by foreign host. so as you can see i dont get the chance to finnish the host:httpbin.org.

so when i try the other examples in course (the html and xml resource )every thing seems to work fine if i am quick but you have to be very quick. So i guess its only logical that i am connecting to the server ok. so i guess i'll have to type faster. Massive thankyou for your help.