0

I have wordpress template in which URL is generating in for of xyz.com/?pickup_location=662#038;pickup_date=2018%2F08%2F08&return_date=2018%2F08%2F10 you can see there & at a place of & so when I trying to get value by $_GET['pickup_date'] it showing blank.

I used $_SERVER['REQUEST_URI'] to get complete URL but it's also not giving me complete URL

it's look like there is use of esc_url() wordpress function. if anyone can help me to get this complete url as a string it can also work for me I could split a string with a parameter name

  • Possible duplicate of [Get fragment (value after hash '#') from a URL in php](https://stackoverflow.com/questions/2317508/get-fragment-value-after-hash-from-a-url-in-php) – Robert Aug 08 '18 at 19:30

1 Answers1

0

Your problem is the #.

Everything that comes after the # is only accessible by the client and not the server.

If you need a # in your URL like that you need to URL encode it:

urlencode('#'); // %23

In your case that will be something like this:

$url = "xyz.com/?pickup_location=" . urlencode("662#038;") . "pickup_date=2018%2F08%2F08&return_date=2018%2F08%2F10";
Casper André Casse
  • 573
  • 2
  • 8
  • 20
  • ?pickup_location=662#038;pickup_date=2018%2F08%2F08 & #038;return_date=2018%2F08%2F10 complete url is this do you have any suggestion to get this complete url? – web developer Aug 08 '18 at 19:33