Making use of RATP's Open Data API for real-time schedule
You need an authorized IP. Go get one on RATP's website.
Then, you might need to activate SOAP functions on your PHP server.
Question: This code is ugly. I want to write my own. Where should I start?
Answer: I agree and I encourage you to write your own. Here is a blog post with a few pointers that you might find useful.