1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting URL parameter from redirect URL

Discussion in 'General Programming Chat' started by eternalwarrior, Apr 19, 2014.

  1. eternalwarrior

    eternalwarrior Jr. VIP Jr. VIP

    Joined:
    Oct 7, 2012
    Messages:
    167
    Likes Received:
    46
    Occupation:
    Internet Marketer
    Location:
    sweden
    Home Page:
    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?
     
    Last edited: Apr 19, 2014
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,706
    Likes Received:
    11,701
    Occupation:
    Pusillanimous Knitter
    Location:
    Buenos Aires
    $_SERVER['HTTP_REFERER'] is your friend.
     
  3. eternalwarrior

    eternalwarrior Jr. VIP Jr. VIP

    Joined:
    Oct 7, 2012
    Messages:
    167
    Likes Received:
    46
    Occupation:
    Internet Marketer
    Location:
    sweden
    Home Page:
    Thanks jazzc.

    I got the solution anyway. I have to edit the redirect php file to pass the variables from redirect URL to final destination URL by putting the code given below:

    Code:
    <?php header("http://domain-b.com/?s=".$_GET['s']); die(); ?>