Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active October 4, 2015 02:18
Show Gist options
  • Save RichardBronosky/2561224 to your computer and use it in GitHub Desktop.
Save RichardBronosky/2561224 to your computer and use it in GitHub Desktop.
rbronosky's mobile tools
# available at http://j.mp/curltools
# quick use:
## curl -sLO http://j.mp/curltools; source curltools
## mcurl http://www.ajc.com
# available at http://j.mp/rbromotools
# quick use:
## curl -sLO http://j.mp/rbromotools; source rbromotools
## mcurl http://www.palmbeachpost.com
curl_android_agent="Mozilla/5.0 (Linux; Android 2.3) AppleWebKit/533.1 (like Gecko) Version/4.0 Mobile Safari/533.1"
curl_iphone_agent="Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A334"
# header only curls
hcurl() { echo "cURLing ${@: -1}"; curl -sL -o /dev/null -D /dev/stdout -b /tmp/cookies.txt -c /tmp/cookies.txt "${@}" | grep -Ei '^(.?$|(HTTP|Server|Set-Cookie|Location)[:/])'; echo; }
# mobile (Android) header only curls
mcurl() { hcurl -A "$curl_android_agent" "${@}"; }
# iPhone
icurl() { hcurl -A "$curl_iphone_agent" "${@}"; }
# Just "X headers" http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Common_non-standard_response_fields
xcurl() { curl -D /dev/stdout -o /dev/null $@ | grep -i '^x-'; }
Xcurl() { xcurl $@ | tr '[:upper:]' '[:lower:]'; } # converted to lowercase
# clone me on github @ https://gist.github.com/RichardBronosky/2561224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment