views:

59

answers:

4

Hey, I'm pretty new to PHP, but I've got a site up and running with a full login/registration script, etc...

I have found ample tutorials on sending data via HttpRequest and getting XML or JSON data back--so I'm pretty comfortable with that. I can't seem to find any information or tutorials on how to write the script that handles those requests and actually sends the information back!

Can someone please direct me to any good tutorials on actually writing the script that can receive the HTTPRequest and return XML data?

+1  A: 
garno
+1  A: 

If you are going to be using AJAX, your best bet is communicating via JSON. It is a lot easier to set and read variables that are preset from the data returned instead of XML.

I know that you have found many tutorials for making AJAX requests, but you should look into using the jQuery Framework (jquery.com) as it is much easier to use all around. It also supports AJAX in some "intense" ways that would require many lines of code otherwise.

If you plan to send a request to a php page and want results returned (providing you are using JSON format), you can use the json_encode($str); function in PHP for converting an array of data into Javascript readable variables. It goes into more depth than that, but it's a start.

Here is a starter tutorial for using jQuery, JSON, and PHP all together. ([jQuery's getJSON with PHP][2]). I hope that will help you get started. Google for other tutorials sing the keywords php, json, jquery.

Good luck with your journey into new territories!

BigRossLabs
+2  A: 

Best one i have seen is http://net.tutsplus.com/tutorials/php/a-better-login-system/ . It walks you through login to RBAC implementation in a clear concise manner.

Thomas Vincent
I'm not going to give this a bad rating because it is helpful, although has nothing to do with what JamesHerriott is looking for.
BigRossLabs
Thanks BigRossLabs, I am not sure how that answer ended up on that page. Must have been a late night. lol
Thomas Vincent
A: 

If you google 'php xml web services' you will find a ton of links that walk you through what you are looking for. But what your probably thinking of is a REST style server.

http://blog.garethj.com/2009/02/building-a-restful-web-application-with-php/ is a good tutorial.

Thomas Vincent