Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1fichier.com direct link generator (PHP)
<?php
if(!isset($_GET['a'])) {
die('<form action="" method="get"><input type="text" name="a"/><input type="submit"/></form>');
}
$url = "https://1fichier.com/?" . urlencode($_GET['a']) . "?auth=1&inline";
stream_context_set_default(array(
'http' => array(
'method' => 'GET',
'header' => 'Authorization: Basic ' . '[BASE64 encoded login credentials. Format: "user:pass" (without quotes)]'
)
));
$headers = get_headers($url, 1);
if ($headers !== false && isset($headers['Location'])) {
$loc = $headers['Location'];
$loc = str_replace("https://", "http://", $loc);
header('Location: ' . $loc, true, 302);
} else {
echo "Failed to unarchive file!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.