Skip to content

Instantly share code, notes, and snippets.

@chojayr
Last active August 29, 2015 14:16
Show Gist options
  • Save chojayr/8b85914006f454af0de2 to your computer and use it in GitHub Desktop.
Save chojayr/8b85914006f454af0de2 to your computer and use it in GitHub Desktop.
#!/bin/bash
####################################
### Just a curl result into json ###
####################################
### How to: $./curl_result2json.sh yoursite2check ###
log=curl_result_`date +"%F"`.json
site=$1
echo "=================================================================="
echo " Results"
echo "=================================================================="
curl -o /dev/null -w "{ \"Content Type\": \"%{content_type}\", \"Connect\": \"%{time_connect}\", \"TTFB\": \"%{time_starttransfer}\", \"Name Look-up Time\": \"%{time_namelookup}\", \"Redirect Time\": \"%{time_redirect}\", \"Header Size\": \"%{size_header}\", \"Request Size\": \"%{size_request}\", \"Downloaded Size\": \"%{size_download}\", \"Remote IP\": \"%{remote_ip}\", \"Remote Port\": \"%{remote_port}\", \"Download Speed\": \"%{speed_download}\", \"Upload Speed\": \"%{speed_upload}\", \"Total Time\": \"%{time_total}\" }\n" $site | python -m json.tool >> $log
echo "=================================================================="
echo " Results: $log "
echo "=================================================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment