Open up Automator and make a new service. In the top bar, set Service Receives to URLs and In to Any Application. Drag over the Run AppleScript action (from the Utilities section) and paste the following code into its entry window, replacing anything that was already there:
on run {input, parameters}
return (do shell script "/usr/bin/curl 'http://qgf.in/api.php?url=" & (item 1 of the input) & "'")
end run
Below that, drag the Copy to Clipboard action. Save the Service as Shorten URL or whatever else you want.