All pastes #1703843 Raw Edit

Anonymous

public text v1 · immutable
#1703843 ·published 2009-12-06 04:14 UTC
rendered paste body
#!/usr/bin/env php<?phpfunction pastoid($paste){	$url = null;	$post = http_build_query(array(		'content' => $paste,		'type' => '1',		));	$context = stream_context_create(array(	'http' => array (		'method' => 'POST',		'header'=> "Content-type: application/x-www-form-urlencoded\r\n"			. "Content-Length: " . strlen($post) . "\r\n",		'content' => $post		)	)); 	if ($page = fopen('http://pastebin.ca/quiet-paste.php?api=SP43GEwFtvwOAEN9F1BdUZAkTXcEXmep', 'r', false, $context)) {		stream_set_timeout($page, 3.5);		$data = stream_get_meta_data($page);		foreach ($data['wrapper_data'] as $header) {			if (preg_match('#^Location:\s*(.*)$#i', $header, $match)) {				$url = $match[1];				break;			}		}		$contents = '';		while (!feof($page)) {			$contents .= fread($page, 8192);		}		var_dump($contents, $data);	}	return $url;}$paste = file_get_contents('php://stdin');pastoid($paste);