Created
August 4, 2015 15:22
-
-
Save SilverCory/6988d1bb633c13ba2273 to your computer and use it in GitHub Desktop.
So you can past log files to hastebin. Because it's moar sexy than the ones they provide.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PUT THIS SECTION AT http://your-site.com/submit.php | |
<?php | |
function grab_dump($var) | |
{ | |
ob_start(); | |
var_dump($var); | |
return ob_get_clean(); | |
} | |
function sendTo( $string ) { | |
//echo( $string ); | |
header( "Location: " . $string ); | |
} | |
$ch = curl_init("http://hastebin.com/documents"); | |
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_POST, 1 ); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST["pastetext"] ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch, CURLOPT_MAXREDIRS, 10); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 20); | |
$response = curl_exec( $ch ); | |
if($errno = curl_errno($ch)) { | |
$error_message = curl_strerror($errno); | |
sendTo( "http://cURL.error/({$errno}):_{$error_message}" ); | |
} | |
$keyJson = json_decode( $response, true ); | |
sendTo( "http://hastebin.com/" . $keyJson['key'] ); | |
//======================================= SECTION TWO ===========================================// | |
// Use this as /usr/share/pastebin.d/hastebin.com.conf | |
// Yeah you need pastebinit. | |
// Something like "sudo apt-get install pastebinit" to install it. | |
/* | |
[pastebin] | |
basename = your-site.com | |
regexp = "http://your-site.com" | |
[format] | |
user = desc | |
content = pastetext | |
page = page | |
[defaults] | |
page = "/submit.php" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment