Getting Url from array for auto redirect

98 views Asked by At

I'm getting response from webservice.This is for response:

$endpoint = 'http://.....';       
$mynamespace = 'http://........';
$client = new nusoap_client($endpoint, true);
$response = $client->call('SaleWithTicket', $param, $mynamespace);

And if I print it I'm getting this result

Array
(
    [SaleWithTicketResult] => Array
        (
            [TicketObjectId] => e1f511a8-610c-4db9-8c22-1effaf4c9ad9
            [TransactionDate] => 2015-06-18T07:00:18.9651562+03:00
            [StatusCode] => 0
            [RedirectUrl] => https://.........
        )

)

These are dynamic structered.

I want auto redirection however I couldn't find a way to go.

1

There are 1 answers

0
Hanky Panky On
$location=$response['SaleWithTicketResult']['RedirectUrl'];
header("Location: $location");

What's hard there? And if that $result doesn't follow a defined structure and can be in a totally different format on a different day then whatever solution you come up with will be just a hack.