Skip to content

Instantly share code, notes, and snippets.

@fliphess
Created February 14, 2017 16:03
Show Gist options
  • Save fliphess/3e436482a7e3f3fb0f86a3e1fb185411 to your computer and use it in GitHub Desktop.
Save fliphess/3e436482a7e3f3fb0f86a3e1fb185411 to your computer and use it in GitHub Desktop.
Test websites using curl
#!/bin/bash
URL="$1"
if [ "x${URL}" == "x" ] || [[ ! "${URL}" =~ "http" ]] ; then
echo "Usage: $0 <url>"
exit 1
fi
curl -L -so /dev/null -w "\n[Info]\n\nStatus Code:\t%{http_code}\nHTTP Version:\t%{http_version}\nRemote IP:\t%{remote_ip}\n\n[Timing]\n\nConnect:\t%{time_connect}\tseconds\nPre-Transfer:\t%{time_pretransfer}\tseconds\nRedirect Time:\t%{time_redirect}\tseconds\nTransfer:\t%{time_starttransfer}\tseconds\nDNS Lookup:\t%{time_namelookup}\tseconds\nTotal Time:\t%{time_total}\tseconds\n\n[Size]\n\nDownload Size:\t%{size_download}\tbytes\nHeader Size:\t%{size_header}\tbytes\nRequest Size:\t%{size_request}\tbytes\n" $URL ; echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment