You have to use an HTTP redirect to redirect the website visitor over to whatever website they go to to pay with their Bitcoins. Once they've done that, you can use the above PHP code to verify the payment went through properly, by passing in information about the supposed transaction, as well as your app's API key, into the API. Note that this is unique to this specific API.
You would integrate it into what you have above by removing lines 218/219 where you print out that registration was successful, and instead do an HTTP redirect to the Bitcoin payment gateway so the new user can pay. Then, you'd create a new PHP page with the confirmBitcoinPayment() code for the Bitcoin gateway to redirect to if the payment is successful. I'm not sure if that made sense.
I'm not sure if you have any interest in it, but you can check out DaniWeb's API as well.