I'm writing a web app that communicates with a HTTP based API. In short, it works like this:
1. My app sends a request to the API using url-encoded HTTP POST (ie http://server/parameter1=foo¶meter2=bar). The parameters varies depending on the request, but things like username and URL are the same every time. 2. The server responds with a XML file, also in url-encoded format. Some of these contain lists of objects with id:s, like this: <players><player><id>1</id><name>foo</name></player><player><id>2</ id><name>bar</name></player> (etc) </players> 3. The response can be an error code, depending on request. 4. Some of the responses should be cached, for a time ranging between 1 minute and 24 hours. I've got some of the server calls working, including simple caching. Right now I just store the XML file and parse it on the fly just to get something up and running, but storing the results in a local database would be preferred. So, to my questions: How is this web API best integrated with CakePHP? I've read about datasources in the manual for the beta and seen the examples for LDAP, and that seems like one way to do it. On the other hand, another solution would be splitting it up into separate parts - one or two components to help with the formatting to and from XML and the url encoding, and one model/object that takes care of all communication to and from the server. Tips? Hints? Other Cake application with similar architecture I can look at? At the moment I'll mostly be implementing the parts of the API that requests information, but easy extensibility is important - adding handling of a new API call to my app should be as easy as possible. I'm using 1.2.0.5875. -- Johan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
