Created
April 25, 2014 16:59
-
-
Save chrisallenlane/11296260 to your computer and use it in GitHub Desktop.
Use cURL to POST data to a URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# specify the target URL | |
url="http://www.example.com" | |
# spoof a user-agent if you need to | |
userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36" | |
# specify the payload data | |
data="id=12345" | |
data="$data&foo=bar" | |
data="$data&baz=bat" | |
# POST the payload | |
echo $data | curl --data @- -v -A "$userAgent" $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment