Skip to content

Instantly share code, notes, and snippets.

@angelbladex
Last active September 3, 2024 15:16
Show Gist options
  • Save angelbladex/b8dcf7a32b8e18050154b72db5911e9d to your computer and use it in GitHub Desktop.
Save angelbladex/b8dcf7a32b8e18050154b72db5911e9d to your computer and use it in GitHub Desktop.
Check page using HTTPie
#Other version for check page, using HTTPie
#previous version (using wget) >https://gist.github.com/angelbladex/dad9308bbdb7e18f384a
# HTTPie https://httpie.io/
function validate_url(){
#using Httpie
if [[ `http -h --verify no --timeout 10 $1 "Cache-Control: no-cache, no-store" | grep -E '200|320|302|303'` ]]; then
# using CUrl
#if [[ `curl --connect-timeout 10 -I -k -s $1 -H 'Cache-Control: no-cache, no-store' | grep -E '200|320|302|303'` ]]; then
echo "URL exist"
else
echo "Error detected. Check URL or internet connection"
fi
exit
}
if [[ ! -n "$1" ]]; then
echo "URL missing"
exit
fi
validate_url "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment