summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Burton <philbeansburton@gmail.com>2015-10-19 11:36:44 +0100
committerPhil Burton <philbeansburton@gmail.com>2015-10-19 11:36:44 +0100
commit8eca1d1fb29f9c5995c9c68b816177190477862e (patch)
tree8db63d1a25f868eb2d49c102e9cbc27d6767a4a3
added readme and script
-rw-r--r--README.md2
-rwxr-xr-xblapaste.php29
2 files changed, 31 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..663feb9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+Takes STDIN and throws it to p.of.je
+Returns the url
diff --git a/blapaste.php b/blapaste.php
new file mode 100755
index 0000000..a46a3c1
--- /dev/null
+++ b/blapaste.php
@@ -0,0 +1,29 @@
+#!/usr/bin/php
+<?php
+
+$stdin = fopen("php://stdin", "r");
+
+$paste = "";
+while (false !== ($line = fgets($stdin))) {
+ $paste .= $line;
+}
+$url = "http://p.of.je/submit.php";
+$myvars = "paste=" . $paste;
+
+$ch = curl_init($url);
+curl_setopt($ch, CURLOPT_POST, 1);
+curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
+curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+curl_setopt($ch, CURLOPT_HEADER, 1);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+
+$response = curl_exec($ch);
+
+$response = explode("\n", $response);
+foreach ($response as $line) {
+ if (strpos($line, "Location") !== false) {
+ echo $line . "\n";
+ exit;
+ }
+}
+echo "failed\n";