Redirect to external url with parameters using zend framework

I want to redirect users to an external payment gateway with some parameters using zend.is is there a standard way to do this?

really appreciate any advice and suggestions.

thanks.

+4
source share
3 answers

You can use the PHP built-in http_build_query function to create parameters, and then pass this to gotoUrlAndExit() in the Zend Framework.

 $url = "https://external.gateway.com/"; $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); $query = http_build_query($data); $this->_helper->redirector->gotoUrlAndExit($url . '?' . $query); 
+6
source

ZF has a Redirector action assistant. It has methods called gotoUrl() and gotoUrlAndExit() that can be used to navigate to external URLs. Perhaps this assistant will be suitable for your needs.

+4
source
 $this->_redirect($url); 

Just put it in your action

+2
source

Source: https://habr.com/ru/post/1345700/


All Articles