I trying to develop a new bank module. The bank has an API and when I send the following URL as a parameter in a request made to the bank's API:
https://www.example.net:443/demo/index.php?order&bank&success&ho
it then returns a response URL containing the outcome of the request as URL parameters, however the bank's API assumes that the URL provided does not already have a query string and simply appends a new complete query string including the ?
to the input URL (for example) ?TPE=monet14&date=12%2f07%2f2018%5fa%5f11%3a32%3a28&monta
, making the final URL:
https://www.example.net:443/demo/index.php?order&bank&success&ho?TPE=monet14&date=12%2f07%2f2018%5fa%5f11%3a32%3a28&monta
However due to the extra ?
character, when I redirect a user to this URL, my server interprets $_GET['ho?TPE']
as a single variable "monet14"
instead of $_GET['ho'] = ""
and $_GET['TPE'] = "monet14"
. When I redirect the remote user to this URL, they are then redirected to index.php
instead of the desired script.
Here is the output of var_dump($_GET)
after redirecting the user:
array(23) {
["order"]=> string(0) ""
["desjardins"]=> string(0) ""
["success"]=> string(0) ""
["ho?TPE"]=> string(7) "monet14"
["date"]=> string(21) "12/07/2018_a_11:32:28"
["montant"]=> string(5) "53EUR"
}
Instead I would like the user to be redirected to:
https://www.example.net:443/demo/index.php?order&bank&success&ho&TPE=monet14
How can I change the extra ?
to an &
in the URL returned by my bank's API before redirecting the user?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…