BotSmith avatar

base64download

filebot

Published: 13 Feb 2019 › Updated: 13 Feb 2019base64download

base64download

base64download.php to access the files from any server running php.

<?php require_once 'cleanstring.php'; $user = $_GET['user']; $permlink = $_GET['permlink']; $jsid = rand(1,90); $content = "{ \"id\":\"$jsid\", \"jsonrpc\":\"2.0\", \"method\":\"get_content\", \"params\":[\"$user\",\"$permlink\"] }";

$url = "http://steemd.privex.io/";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

$json_response = curl_exec($curl);

$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ( $status != 200 ) {
$url = "https://api.steemit.com/";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

$json_response = curl_exec($curl);

$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ( $status != 200 )
{
    die("No Steem Api response, please try again.");
}

}

curl_close($curl);

$response = json_decode($json_response, true);

$compbody = $response['result']['body'];

$teile = explode("base64filename", $compbody);

$filename = $teile['1'];
$filebodyprep = $teile['2'];
$teile = explode("base64file",$filebodyprep);
$filebody = $teile['1'];
$filebody = base64_decode($filebody);
$filename = removespace($filename);

$tempdir = sys_get_temp_dir();
$tmpName = "$tempdir/$filename";

$file = fopen($tmpName, 'w');

fwrite($file, $filebody);
fclose($file);

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($tmpName).'"');
header('Pragma: public');
header('Content-Length: ' . filesize($tmpName));
readfile($tmpName);

ob_clean();
flush();
unlink($tmpName);
//decode test end

?>

Leave base64download to:

Written by

Read more #base64 posts


Best Posts From BotSmith

We have not curated any of filebot's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From BotSmith