Skip to content
cyvax edited this page Jul 18, 2021 · 4 revisions

Welcome to the Privatebin_PHP wiki!

Table of Contents

example

Two method to use Privatebin_PHP
  • first method
use Cyvax\PrivatebinPHP;

$private =new PrivatebinPHP();
$private->set_url("https://privatebin.net/");
$private->set_expire("5min");
$private->set_password("Privatebin_PHP");
$private->set_formatter("plaintext");
$private->set_burn(true);
$private->set_text("Because ignorance is bliss!");
$encoded = $private->encode();
$posted = $private->post($encoded);
$posted = $private->encode_and_post();
  • second method
use Cyvax\PrivatebinPHP;

$private =new PrivatebinPHP(array(
    "url" => "https://privatebin.net/",
    "text" => "Because ignorance is bliss!",
));
$posted = $private->encode_and_post();

set_password()

set paste password
  • @param string $password

set_url()

set privatebin url.
  • @param string $url

set_formatter()

set paste formatter
  • @param string $formatter
  • @param bool $bypass
  • @throws PrivatebinException

set_attachment()

set the attachment, use file_location as url or path, use filename to force a filename.
  • @param string $file_location
  • @param string $filename

set_text()

set the text of the paste!
  • @param string $text

set_compression()

set compression method
  • @param string $compression : zlib or none
  • @throws PrivatebinException

set_discussion()

set discussion true or false, (default : true)
setting this to true will desactivate burn if it's to true.
  • @param bool $discussion

set_burn()

set burn true or false, (default : false)
setting this to true will desactivate discussion if it's to true.
  • @param bool $burn

set_debug()

set debug true or false, (default : false)
setting this to true will cause debug information to be printed.
  • @param bool $debug

set_expire()

set expire time, (default : 1day)
use bypass for value not in ["5min", "10min", "1hour", "1day", "1week", "1month", "1year", "never"]. (default : false)
  • @param string $expire
  • @param bool $bypass
  • @throws PrivatebinException

encode()

Encode string to a paste, return ready to post data with b58 key.
  • @return array|Exception[]
  • @throws PrivatebinException

post()

post data generated by encode().
  • @param array $data
  • @return array
  • @throws PrivatebinException

encode_and_post()

encode and post data.
  • @return array
  • @throws PrivatebinException

options for PrivatebinPHP:

{
  "url": "https://paste.i2pd.xyz/",
  "compression": "zlib",
  "formatter": "plaintext",
  "attachment": null,
  "attachment_name": null,
  "password": null,
  "expire": "1day",
  "discussion": false,
  "burn": false,
  "text": "",
  "debug": false,
}