Jump to:

23368 Posts in 18143 Topics by 2863 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, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2258 Views
  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Working with HTTP POST variables from within Sapphire Link to this post

    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.

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Working with HTTP POST variables from within Sapphire Link to this post

    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');

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Working with HTTP POST variables from within Sapphire Link to this post

    Hmm, I wasn't aware of the SS_HTTPRequest object. Thanks for pointing it out, I'll give it a try now.

    2258 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.