<?php
// In vim, type :X,Yw !php pastebin.php where X and Y is your line range
// Note the space between the 'w' and the '!' is important!
// Obviously, modify the path to the script as needed to conform to your system

$params = array(
    
CURLOPT_URL => 'http://www.paste2.org/new-paste',
    
CURLOPT_POST => true,
    
CURLOPT_HEADER => true,
    
CURLOPT_RETURNTRANSFER => true,
    
CURLOPT_POSTFIELDS => array(
        
'lang' => 'php',
        
'description' => '',
        
'code' => trim(stream_get_contents(STDIN)),
        
'parent' => '0'
  
)
);

$ch curl_init();
foreach (
$params as $key => $value) {
    
curl_setopt($ch$key$value);
}
$response curl_exec($ch);
curl_close($ch);

preg_match('/Location: (.*)/'$response$match);
echo 
'http://www.paste2.org' $match[1];