[eluser]Phil Sturgeon[/eluser]
You might be adding in a complication that you don't need. Most API's I have worked with simply use &format=json and run it all via the same file.
Anyway, what .htaccess are you using for this as it should not be looking for an actual categories.php. The fact the routing fails also suggests CI is not handling this request.