Php conversion

Hey guys, as it stands this code runs but there are still a couple kinks to work out. I noticed if there are no predictions then I get a js error because even though I have a 200 coming back, there's nothing to work with. There are a couple small things like that but for the most part I'm pretty happy with it. The JS probably could use a refactor but I tried to make it fairly clean without too much cruft.  If you have any questions or notice something explodes just let me know and I'll take a look :)