I'd like to use the Restful API for one of my Objects. It works all great when I login with the browser. But how do I login using a HTTP GET with Silverstripe? Do I have to use curl to make a POST on the login form (http://my.domain.com/Security/login...) before accessing the API? Any other solution?
Well, not really. Your solution works in a browser, because it accepts Session/Cookie data. But when you try that with file_get_contents(), it will fail because of the redirect after a successful login. Therefore it will be neccessary to use curl to survive the redirect and remember Session/Cookie data.
I'm interested in a solution that allows the use of file_get_contents(http://myurl.de/api/v1/MyObject/)