Skip to content

Instantly share code, notes, and snippets.

@angelbladex
Created March 22, 2023 20:45
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(){
if [[ `http -h $1 --verify no 2>&1 --timeout 20 | grep -E '200|320|302'` ]]; 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