Implementing an IPN Listener
You can write your IPN listener in the scripting or programming language of your choice and host it on your web server.
You can use a sample IPN message as a starting point.
As a good programming practice, as well as to keep things simple, your IPN listener should listen for a post from PayPal and dispatch it immediately to another routine or process that handles the business logic associated with the message. If your listener is structured in this way, it will be a simple and tight loop that listens for a message and dispatches it for processing by your application logic.