Code Samples
Below are some code samples to give you an idea of how I structure my web applications (Links will open a new window):
-
Curl Sample
Example of using the cURL library in PHP to request information from a remote service.
-
Ajax Sample, client side
Example of using ajax and jQuery on the client side to request information from the application server.
-
Ajax Sample, server side
Example of using PHP to handle ajax calls from the client. Generally I use a single point of entry on the server side to handle all incoming ajax requests, and assign different server-side handlers to each request. If I want to add security features to check for login, permissions, or security on the IP level, it's much easier to add if a single point of entry is defined, as opposed to using several PHP files to handle different requests.