Created
July 25, 2014 00:41
-
-
Save kyrannian/42911ae698b265182469 to your computer and use it in GitHub Desktop.
Hastebin PHP Client
This file contains hidden or 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
function paste_to_hastebin($data) { | |
$ch = curl_init(); | |
$url = "http://192.168.20.160:7777"; | |
curl_setopt($ch, CURLOPT_URL, $url . "/documents"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | |
$output = curl_exec($ch); | |
curl_close($ch); | |
$output = json_decode($output, true); | |
$paste_url = $url . "/" . $output["key"]; | |
return $paste_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple tool for posting data to a hastebin server and returning the URL that points to the document