HTTP GET, POST, and PUT with curl
Curl is one of those swiss army knife type command line utilities for developers who need to develop web services or network software. I keep forgetting the command line syntax using curl, so I thought I would post it here in its artful simplicity.
HTTP GET to a URL:
curl http://www.domain.com/index.html
HTTP PUT a file to a URL:
curl -X -d @mytestfile.xml http://www.domain.com/script.php
HTTP POST a string to a URL:
curl -d "String to post" http://www.domain.com/script.php
HTTP POST a file to a URL:
curl -d @file_to_post.xml http://www.domain.com/script.php
Enjoy.
HTTP GET to a URL:
curl http://www.domain.com/index.html
HTTP PUT a file to a URL:
curl -X -d @mytestfile.xml http://www.domain.com/script.php
HTTP POST a string to a URL:
curl -d "String to post" http://www.domain.com/script.php
HTTP POST a file to a URL:
curl -d @file_to_post.xml http://www.domain.com/script.php
Enjoy.
Mis-posted by ScribeFire and corrected by hand.
Labels: Programming
Post a Comment