Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 19th Apr 2014, 01:57 AM   #1
skype: itsmenasif
 
eternalwarrior's Avatar
 
Join Date: 2011
Location: 49.8380° N, 105.8203° E
Posts: 619
Thanks: 257
Thanked 104 Times in 99 Posts
Default
Getting URL parameter from redirect URL
Share on: 
fb share twitter share gplus share more share

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?
eternalwarrior is offline  
Unread 19th Apr 2014, 04:23 AM   #2
MotionLeads
War Room Member
 
BrainyBiz's Avatar
 
Join Date: 2011
Posts: 75
Thanks: 12
Thanked 29 Times in 18 Posts
Default
Re: Getting URL parameter from redirect URL
Share on: 
fb share twitter share gplus share more share

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'];
?>
BrainyBiz is offline  
Unread 19th Apr 2014, 04:26 AM   #3
Warrior Member
 
Join Date: 2013
Posts: 24
Thanks: 1
Thanked 2 Times in 2 Posts
Default
Re: Getting URL parameter from redirect URL
Share on: 
fb share twitter share gplus share more share

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
luther88 is offline  
Unread 19th Apr 2014, 09:05 AM   #4
Advanced Warrior
 
Join Date: 2007
Location: , , Canada.
Posts: 563
Thanks: 2
Thanked 101 Times in 88 Posts
Default
Re: Getting URL parameter from redirect URL
Share on: 
fb share twitter share gplus share more share

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>
crams is offline  
Unread 19th Apr 2014, 09:57 AM   #5
Advanced Warrior
 
Join Date: 2007
Location: , , Canada.
Posts: 563
Thanks: 2
Thanked 101 Times in 88 Posts
Default
Re: Getting URL parameter from redirect URL
Share on: 
fb share twitter share gplus share more share

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
crams is offline  
Unread 30th Apr 2014, 04:05 AM   #6
WordPress Ninja
 
wpbasit's Avatar
 
Join Date: 2014
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default
Re: Getting URL parameter from redirect URL
Share on: 
fb share twitter share gplus share more share

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.

wpbasit is offline  
Closed Thread


Bookmarks

Tags
parameter, redirect, url


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:46 PM.