hack4lk Posted March 1, 2006 Share Posted March 1, 2006 Hello everyone, I was just wondering if there is a way to pass the main server url from one site to another because I would like to build a simple referral system that when someone clicks on a referral link in www.site1.com/sample.html , they are redirected to www.site2.com/referral.php, which catches the first url and says something like "thank you for visiting our sister site www.site1.com, please proceed".I know that I can use $_SERVER to hold the variable locally but how do i pass that through a url and strip away everyting but the server url....thanks a lot in advance. Quote Link to comment https://forums.phpfreaks.com/topic/3866-pass-server-url-from-site-to-site/ Share on other sites More sharing options...
Hooker Posted March 2, 2006 Share Posted March 2, 2006 change sample.html to sample.php to start, then where you link to the seconds site simply add:[code]http://www.site1.com/referral.php?ref=site1[/code]then go to referral.php and add:[code]$referrer = $_GET['ref'];[/code]Then still in referral.php wherever you want it to say "thank you for visiting our sister site www.site1.com, please proceed" just add:[code]echo "thank you for visiting our sister site $referrer, please proceed";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/3866-pass-server-url-from-site-to-site/#findComment-13483 Share on other sites More sharing options...
hack4lk Posted March 2, 2006 Author Share Posted March 2, 2006 Thanks...it works great!!! Quote Link to comment https://forums.phpfreaks.com/topic/3866-pass-server-url-from-site-to-site/#findComment-13556 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.