Skip to content

Instantly share code, notes, and snippets.

@kyrannian
Created July 25, 2014 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyrannian/42911ae698b265182469 to your computer and use it in GitHub Desktop.
Save kyrannian/42911ae698b265182469 to your computer and use it in GitHub Desktop.
Hastebin PHP Client
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;
}
@kyrannian
Copy link
Author

Simple tool for posting data to a hastebin server and returning the URL that points to the document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment