rendered paste body#!/usr/bin/env php<?phpfunction pastoid($paste, $name, $api){ $post = http_build_query(array( 'content' => $paste, 'type' => '5', )); $context = stream_context_create(array( 'http' => array ( 'name'=>$name, 'method' => 'POST', 'header'=> "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($post) . "\r\n", 'content' => $post ) )); if ($page = fopen('http://pastebin.ca/quiet-paste.php?api=' . $api, 'r', false, $context)) { stream_set_timeout($page, 3.5); $contents = ''; while (!feof($page)) { $contents .= fread($page, 8192); } if (preg_match('#SUCCESS:\s*(\d*)#is', $contents, $match)) { $url = 'http://pastebin.ca/'.$match[1]; shell_exec('/home/matt/.bin/notify.py "Pasted to Pastebin" "' . $url . '"'); shell_exec('echo "' . $url . '"| xclip -sel clip'); } else { shell_exec('/home/matt/.bin/notify.py "Paste Failed" "Could not paste to pastebin. Sorry."'); } } return $url;}$paste = file_get_contents('php://stdin');pastoid($paste, 'Matt Read', 'SP43GEwFtvwOAEN9F1BdUZAkTXcEXmep');