summaryrefslogtreecommitdiff
path: root/blapaste.php
blob: a46a3c196fc7edf85194298f29d714d8ac078d6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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";