0

how to create a fake POST to bypass

    $_POST = array('blahblah'=>1);
    $_REQUEST = array('blahblah'=>1);

    if($this->getRequest()->isPost())
    {
        echo 'horray bypassed';
    }else
    { 
           echo ':(';
    }

and is not working

here the answer:

$_SERVER['REQUEST_METHOD'] = 'POST';
/* by pass */

$this->getRequest()->isPost()
  • question not clear? where do you want to bypass? why do you want to bypass? – Rajeev K Tomy Sep 24 '14 at 4:32
  • question updated, why? let say,..just wondering – Ansyori Sep 24 '14 at 4:34
  • I think you can not By pass this way – Keyul Shah Sep 24 '14 at 4:36
  • $_POST has not any relation with $this->getRequest()->isPost() – Keyul Shah Sep 24 '14 at 4:38
  • 1
    Your question seems out of context. Can you describe, in relation to intended magento functionality, what you intend to do, then maybe someone can help you. – ProxiBlue Sep 24 '14 at 4:46
3

Have a look at Zend_Controller_Request_Http were the isPost() method is found and you will see the method is as follows:

public function isPost()
{
    if ('POST' == $this->getMethod()) {
        return true;
    }

    return false;
}

and getMethod() is:

public function getMethod()
{
    return $this->getServer('REQUEST_METHOD');
}

So isPost() doesn't look for the existence of data in the $_POST array to detect a POST request, it looks at the $_SERVER variable REQUEST_METHOD.

| improve this answer | |
  • For me worked $this->getRequest()->getServer('REQUEST_METHOD'); Thanks! – Albeis Jul 24 '18 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.