Results 1 to 9 of 9
  1. #1
    Full Member Zdig's Avatar
    Join Date
    February 26th, 2005
    Posts
    274
    how to pass a url parameter to a php redirect?
    kind of a rookie question:

    if i want to add a parameter to an inbound url to my site, such as:

    domain.com/?id=123

    how can i append that id to the affiliate urls in my php redirect file?

    so, when people link to my php redirect and go to the merchant site, i can do things like CJ sid tracking etc..

  2. #2
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    The outbound link:

    http://www.andreowz.com/clickblahblahblah?sid=<?=$_REQUEST['id']?>

  3. #3
    Full Member Zdig's Avatar
    Join Date
    February 26th, 2005
    Posts
    274
    thanks, i'll give that a shot.

  4. #4
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    Now that will only work if they click off immediately.. if they browse around a few pages, the request will be gone. In that case, I would cookie them with it

    setcookie("requestid",$_REQUEST['id'],time()+(86400*365),"/");

    and then on the outbound link use

    ?sid=<?=$_COOKIE['requestid']?>

  5. #5
    Full Member Zdig's Avatar
    Join Date
    February 26th, 2005
    Posts
    274
    so i put the setcookie info in the redirect file?

    thanks again

  6. #6
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    I would put the setcookie in a routine that is loaded with EVERY page.. so no matter what page they land on, they will get a cookie if appropriate.. so in your global file:

    if ($_REQUEST['id'])
    {
    setcookie(etc)....
    }

    and then in the redirector, add this part on to your CJ link

    &sid=<?=$_COOKIE['requestid']?>


    Sorry if it is confusing but I'm not sure if you actually have a site for people to browse or if they are forwarded on immediately. If you do not have a site for them to browse, you can just use the first little snippet I posted and not worry about the cookie.

  7. #7
    Full Member Zdig's Avatar
    Join Date
    February 26th, 2005
    Posts
    274
    yes, the cookie will be helpful, thank you

  8. #8
    Full Member Zdig's Avatar
    Join Date
    February 26th, 2005
    Posts
    274
    so...it would look like?

    <?php if ($_REQUEST['id']) setcookie("requestid",$_REQUEST['id'],time()+(86400*365),"/"); ?>

  9. #9
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    Looks correct to me offhand.

  10. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. url masking using htaccess or php redirect
    By breeke in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: April 29th, 2010, 07:48 PM
  2. Changing Destination Page with URL= Parameter
    By peedtih in forum Rakuten LinkShare - LS
    Replies: 9
    Last Post: April 13th, 2004, 10:40 AM
  3. Redirect URL Parameter
    By newemail in forum Rakuten LinkShare - LS
    Replies: 1
    Last Post: December 4th, 2003, 05:24 PM
  4. Redirect URL Parameter
    By newemail in forum Commission Junction - CJ
    Replies: 6
    Last Post: December 4th, 2003, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •