#!/usr/bin/ruby require 'rubygems' require 'net/http' require 'hpricot' class PasteBin attr_reader :file, :code def initialize(file) @file = file @code = nil end def getCode @code = File.read(@file) end def sendCode data = { :parent_pid => nil, :format => "text", :code2 => @code, :poster => nil, :paste => "Send", :expiry => "m" } @response = Net::HTTP.post_form(URI.parse('http://pastebin.com/pastebin.php'), data) end def getLink puts @response end end paste = PasteBin.new(ARGV[0]) paste.getCode paste.sendCode paste.getLink