You need to use Paypal's Instant Payment Notification, or IPN. IPN does just what you're talking about - when you receive a payment, it posts data back to a script on your website that you specify.
IPN is somewhat complicated, so I won't really explain how it's done here. Paypal has plenty of documentation on it, but I believe you need to have a Premier or Business account to get access to it. Start searching around on Paypal, you should find it.
One useful tool to go along with that is the Paypal Sandbox, which lets you test out IPN (among other things). You can simulate payments sent to your account, and make sure that everything works correctly.
That should be enough to get you going. Do a little research on those topics, and let me know how everything works out.