i tried to create a script to redirect link of amazon, but when pass the link in a get variable url not return Url after the character &, i tried to echo the variable $_GET['tolink'] but display a cut url, my code:
$url = $_GET['tolink']; header("HTTP/1.1 301 Moved Permanently"); header("Location: $url");
when pass the url in a variable thi code redirect to :
https://www.amazon.com/SAMSUNG-50-Inch-Crystal-AU8000-Built/dp/B08Z1RN7NP/ref=sr_1_2?keywords=samsung%20tv
intestead to
https://www.amazon.com/SAMSUNG-50-Inch-Crystal-AU8000-Built/dp/B08Z1RN7NP/ref=sr_1_2?keywords=samsung+tv&qid=1685363216&sr=8-2
i tried also just to var_dump( $_GET['tolink'])
and echo cut url, why ?
UPDATE: found a solution, use $_SERVER['QUERY_STRING']
intestead $_GET['tolink']
it's works but is a safe solution ?