Search code examples
cakephp-2.0parameter-passingresponsepayment

Cakephp URL parameter retrieving ()


How can I retrieve the responsekey from a payment site using my cakephp controller?

The major issue is that I'm receiving a response key from the payment integration site with special charaters like \ /+%&, etc. While executing a link like the following, I get a 'page not found' error.

domain.com/Controller/action/reskey:IXcJUEkT//rGWiqllgOmJcw1P1CW362ZMAkoSMPHM+SMppkWVKzxLg+/m1VNUAKwrQ1+lfcJkQEnyp0nb/+D1ur

How can I get the response key as a passed argument in my controller function?


Solution

  • Try this:

    public function key(){ //change the key action name yo your action
    
         //$this->params->url will result to domain.com/Controller/action/reskey:IXcJUEkT//rGWiqllgOmJcw1P1CW362ZMAkoSMPHM+SMppkWVKzxLg+/m1VNUAKwrQ1+lfcJkQEnyp0nb/+D1ur
    
        list($url,$reskey) = split(":",$this->params->url); //split via ":"
        debug($reskey); //returns to 'IXcJUEkT//rGWiqllgOmJcw1P1CW362ZMAkoSMPHM+SMppkWVKzxLg+/m1VNUAKwrQ1+lfcJkQEnyp0nb/+D1ur'
        exit;
    }