Note that there are some explanatory texts on larger screens.

plurals
  1. POCakePHP and handling parameters in REST
    primarykey
    data
    text
    <p>So first, let me explain what I am trying to do.</p> <p>I have successfully implemented a SOAP service with CakePHP, using this tutorial:</p> <p><a href="http://bakery.cakephp.org/articles/Marcelius/2009/02/10/soap-services-in-cakephp" rel="nofollow">http://bakery.cakephp.org/articles/Marcelius/2009/02/10/soap-services-in-cakephp</a></p> <p>That part works great. I can send and receive XML messages via SOAP, and I have about 6 controllers with a bunch of different functions setup to handle those requests.</p> <p>What I want to have is this same application also able to handle requests via REST. So far, I've managed to add mapResources() and parseExtentions() to my routes.php file and it's working great for functions that don't require any parameters to be passed in to work properly, i.e. I can go to a URL like </p> <p>localhost/directory/controller_name/function_name.xml </p> <p>... and I'll get back all the results, and I barely have to touch my existing code to get it to work.</p> <p>However, I am having real difficulty getting this to work when the function needs some input parameter to work properly -- some of these variables can get rather complex too, like an array.</p> <p>I've read about how you can use file_get_contents("php://input") to fetch and parse the incoming request body but that really doesn't seem to work too well, because I have to go back and change all my existing code to fetch from that source, and every function call throws a warning for missing parameters. </p> <p>Is what I'm trying to do possible? What would be the best way to handle this situation with CakePHP? </p> <p>TIA</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload