Heray-Was-Here
Server : nginx/1.30.2
System : Linux elegant-dhawan.198-71-59-75.plesk.page 5.15.0-105-generic #115-Ubuntu SMP Mon Apr 15 09:52:04 UTC 2024 x86_64
User : realtyna_guys ( 10000)
PHP Version : 8.2.31
Disable Function : opcache_get_status
Directory :  /opt/psa/admin/sbin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/psa/admin/sbin/fetch_url
#!/bin/bash
### Copyright 1999-2026. WebPros International GmbH. All rights reserved.

umask 022
output=`mktemp`
trap 'rm -f $output;' TERM INT EXIT

if [ -z "$output" ]; then
	echo "Cannot create temporary file for execution" >&2
	exit 1
fi

if [ -z "$1" ]; then
	echo "URL not specified" >&2
	exit 1
fi

http_code=`/usr/bin/curl -A "Plesk (fetch_url utility)" -sS -L -k -o "$output" -w "%{http_code}" "$1"`

if [ $? -ne 0 ]; then
	echo "Unable to fetch URL: $1" >&2
	exit 1
fi

# 2xx and 3xx are considered successful (however, 3xx shouldn't be present due to -L above)
rc=0
[ "$http_code" -ge 200 -a "$http_code" -lt 400 ] || rc=1

# In case of error all messages go to stderr
[ "$rc" -eq 0 ] || exec >&2

echo "Url '$1' fetched"
echo "Status: $http_code"
if [ -s "$output" ]; then
	echo "Output:"
	cat "$output"
fi
exit "$rc"

Hry