21285 Posts in 5732 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » Working with HTTP POST variables from within Sapphire
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1380 Views |
-
Working with HTTP POST variables from within Sapphire

10 May 2011 at 6:56am
I tried straight out using the $_POST variables in a controller, and it seemed to not work. However, using them in a non-controller file, such as its own standalone file in the root of the site dir, worked. Is there a method for working with HTTP POST in sapphire, or is there a work-around for it?
Basically, I have some data being posted to a SS site from another, external site on a different domain, and I want to build a controller that can receive and handle that data.
Thanks in advance for any tips.
-
Re: Working with HTTP POST variables from within Sapphire

10 May 2011 at 8:12am
There is no reason for $_POST access to not work.
In SilverStripe, you access the SS_HTTPRequest object to get request values. In your controller, they're accessed by $this->request->postVar('varName');
-
Re: Working with HTTP POST variables from within Sapphire

10 May 2011 at 12:37pm
Hmm, I wasn't aware of the SS_HTTPRequest object. Thanks for pointing it out, I'll give it a try now.
| 1380 Views | ||
|
Page:
1
|
Go to Top |

