| | #1 |
| skype: itsmenasif Join Date: 2011 Location: 49.8380° N, 105.8203° E
Posts: 619
Thanks: 257
Thanked 104 Times in 99 Posts
|
How do I get URL parameter from redirect URL? Like the redirect url here is a-domain.com/tracking/go.php?c=variables&s={keyword} which will be redirected to b-domain.com/landing-page.php I want the parameter of the redirect URL "{keyword}" to be received by the final page and show it up in b-domain.com/landing-page.php I have used the following code in b-domain.com/landing-page.php: <?php $target = $_GET['s']; ?> <h1>Welcome <?php echo $target; ?> Visitors!!!</h1> But it's not working. Can anyone help me in this? |
| |
| | #2 |
| MotionLeads War Room Member Join Date: 2011
Posts: 75
Thanks: 12
Thanked 29 Times in 18 Posts
|
You would have to redirect to: b-domain.com/landing-page.php?s={keyword} You will need to pass the query string for 's' to the page on b-domain.com to be able to get the variable. You would then use your original code on b-domain.com/landing-page.php. Code: <?php $target = $_GET['s']; ?> |
| |
| | #3 |
| Warrior Member Join Date: 2013
Posts: 24
Thanks: 1
Thanked 2 Times in 2 Posts
|
first of all, never output anything that can be manipulated without first sanitizing it: $target = htmlentities($_GET['s']); that way you prevent XSS now, to come back to your question: you have to pass the paramter along to your final page if you want it to be available there depending on how you redirect to the page, it should be something like this: header("Location: http://b-domain.com/landing-page.php?s=".$target); then you can use this parameter on your page. If you do not want to show the parameter in the url you can store it in a session variable |
| |
| | #4 |
| Advanced Warrior Join Date: 2007 Location: , , Canada.
Posts: 563
Thanks: 2
Thanked 101 Times in 88 Posts
|
You do have cpvlab, use it and make sure you check this. either if you;re direct linking to offer or using landing page you'll need to have "pass target" checked. not sure adtrackzgold will be able to pass variables through a redirect. and use <?php $target = $_GET['s']; ?> <h1>Welcome <?php echo $target; ?> Visitors!!!</h1> |
| |
| | #5 |
| Advanced Warrior Join Date: 2007 Location: , , Canada.
Posts: 563
Thanks: 2
Thanked 101 Times in 88 Posts
|
have you tried using your redirect like this? a-domain.com/tracking/go.php?c=variables&s={keyword}&cpc=55&u=b-domain.com/landing-page.php?s={keyword}&p=all |
| |
| | #6 |
| WordPress Ninja Join Date: 2014
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
|
You can use JavaScript to determine the last url which is (a-domain.com/tracking/go.php?c=variables&s={keyword}) at your final page and then parse the keyword from that URL string using RegEx.
|
| | |
| |
|
| Bookmarks |
| Tags |
| parameter, redirect, url |
| |