| Server IP : 150.230.34.123 / Your IP : 216.73.217.23 Web Server : LiteSpeed System : Linux amd-instance-20210802-1657 5.15.0-1042-oracle #48~20.04.1-Ubuntu SMP Mon Aug 21 18:27:46 UTC 2023 x86_64 User : ubuntu ( 1001) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/cwd/aloysius_backup/ |
Upload File : |
<?php
// proxy.php
// Usage: proxy.php?url=https://lh3.googleusercontent.com/...
header("Access-Control-Allow-Origin: *");
$url = isset($_GET['url']) ? $_GET['url'] : '';
if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
http_response_code(400);
exit("Invalid or missing 'url' parameter");
}
// Fetch headers first to detect MIME type
$headers = get_headers($url, 1);
$contentType = "image/jpeg"; // default fallback
if ($headers !== false) {
foreach ($headers as $key => $value) {
if (strtolower($key) === "content-type") {
// handle multiple headers case
if (is_array($value)) {
$contentType = $value[0];
} else {
$contentType = $value;
}
break;
}
}
}
// Set the correct content type
header("Content-Type: " . $contentType);
// Stream the image
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 0,
]);
$data = curl_exec($ch);
curl_close($ch);
if ($data === false) {
http_response_code(502);
exit("Failed to fetch image");
}
echo $data;