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.

Mis-posted by ScribeFire and corrected by hand.

This entry was posted in Software Development and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s