ShaolinF Posted August 11, 2007 Share Posted August 11, 2007 Hi Guys, Is there anyway of me grabbing the previous link the user has been on ? Say for example the user was on www.awebsite.com and then clicks my link through that site, is it possible for a script or something to grab the www.awebsite.com url ? Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/ Share on other sites More sharing options...
ILYAS415 Posted August 11, 2007 Share Posted August 11, 2007 Try using this code: <? $url= $_SERVER['HTTP_REFERER']; //GET THE REFERRING URL echo "You have just came from $url!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/#findComment-321178 Share on other sites More sharing options...
LiamProductions Posted August 11, 2007 Share Posted August 11, 2007 Hmmm not sure if this works but i've heard about it. <?php $url = $_SERVER['HTTP_REQUEST']; echo $url; might not work but you might understand how to get it by looking at the http request. Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/#findComment-321181 Share on other sites More sharing options...
ILYAS415 Posted August 11, 2007 Share Posted August 11, 2007 Neither of them seem to work on my site. Their must be something wrong with my server :@ annoying server :[ Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/#findComment-321192 Share on other sites More sharing options...
LiamProductions Posted August 11, 2007 Share Posted August 11, 2007 HTTP REQUEST gets the url your on i think. But the one the other guy posted should work. and does your php server support php short tags if not use <?php and sorry my code was missing a ?> My server doesnt support short tags and it works if i use the full tag try it Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/#findComment-321198 Share on other sites More sharing options...
ILYAS415 Posted August 11, 2007 Share Posted August 11, 2007 hehe i am the other guy who posted the $_SERVER['HTTP_REFERER']; command. I tried it on my own server but it didnt work Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/#findComment-321210 Share on other sites More sharing options...
LiamProductions Posted August 11, 2007 Share Posted August 11, 2007 hehe i am the other guy who posted the $_SERVER['HTTP_REFERER']; command. I tried it on my own server but it didnt work It works for me. Just does'nt update it inless i close the browser then re open it. well achually it only works if im using the link on a page on my website. Quote Link to comment https://forums.phpfreaks.com/topic/64424-grabbing-urls/#findComment-321255 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.