Is it possible to issue http methods like get,post manually without using browser?
I would like to know whether its possible to execute different http protocol methods like GET,POST,HEAD,etc manually without using browser either through command prompt or using any programming language?
If开发者_JAVA百科 yes, then how to do this?
Please enlighten !!!
Curl makes this pretty easy:
# get
curl http://www.google.com/
# head
curl -I http://www.google.com/
# post application/x-www-form-urlencoded
curl -d "parameter1=value1¶meter2=value2" http://stackoverflow.com
Look at the command-line docs for examples of how to do more advanced requests.
Telnet from command line in windows, all programming languages (almost) has their own API for this.
Almost every language has at least one mechanism for performing HTTP requests. From the command line you can use tools such as wget and cURL.
It's possible, using php's header() functions or using telnet and typing out the headers manually.
You can use wget or curl to do this automatically, and if you want to do this by hand, use telnet or netcat.
Read RFC 2616 or Wikipedia.
Connect to the server:
$ telnet www.example.com 80 Trying 192.0.32.10... Connected to www.example.com. Escape character is '^]'.
Enter your request:
GET / HTTP/1.1 Host: www.example.com Connection: close
(That’s two newlines at the end)
Examine the response:
HTTP/1.0 302 Found Location: http://www.iana.org/domains/example/ Server: BigIP Connection: close Content-Length: 0
There are also countless libraries, such as Python’s httplib.
精彩评论