Last active
September 3, 2024 15:16
-
-
Save angelbladex/b8dcf7a32b8e18050154b72db5911e9d to your computer and use it in GitHub Desktop.
Check page using HTTPie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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