Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirecting to external url with params using zend framework

I want to redirect users to a external payment gate with some parameters using zend.is there any standard way of doing it ?

really appreciate any advice and suggestions.

thanks.

like image 640
sha Avatar asked Dec 16 '22 15:12

sha


2 Answers

You could use the built in PHP function of http_build_query to build the parameters, then feed that to the gotoUrlAndExit() function of 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);
like image 66
Shane Stillwell Avatar answered Apr 07 '23 21:04

Shane Stillwell


In ZF there is Redirector action helper. It has methods called gotoUrl() and gotoUrlAndExit() that can be used to go to external urls. Maybe this helper will be suited for your needs.

like image 40
Marcin Avatar answered Apr 07 '23 21:04

Marcin