Skip to content

Instantly share code, notes, and snippets.

@NicolasLoew
Forked from null-dev/index.php
Created June 24, 2017 06:26
Show Gist options
  • Save NicolasLoew/3eb6666dbc92a9175cd6cc2dd3f5d202 to your computer and use it in GitHub Desktop.
Save NicolasLoew/3eb6666dbc92a9175cd6cc2dd3f5d202 to your computer and use it in GitHub Desktop.
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