Skip to content

Instantly share code, notes, and snippets.

@null-dev
Created June 19, 2017 23:51
Show Gist options
  • Save null-dev/59d219649670d81b65348c7abf4dd13b to your computer and use it in GitHub Desktop.
Save null-dev/59d219649670d81b65348c7abf4dd13b 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