The Little Guy Posted November 28, 2006 Share Posted November 28, 2006 [code]<?phpfunction get_id($url){ $end = $url; $begin = $_SERVER['SCRIPT_NAME']; $var1 = str_replace($begin,'',$end); $var2 = str_replace('?id=','',$var1); return $var2;}echo 'http://'.get_id($_SERVER['REQUEST_URI']);?>[/code]http://tzfiles.com/phpcode/entities.php?id=d-top.org/display.php?artist=orgy Link to comment https://forums.phpfreaks.com/topic/28752-retrieve-a-whole-url-via-get-or-is-there-a-better-way/page/2/#findComment-131774 Share on other sites More sharing options...
jpratt Posted November 28, 2006 Share Posted November 28, 2006 Why dont you use taiths function and add a substr to it to wack off the leading charaters you dont want? Link to comment https://forums.phpfreaks.com/topic/28752-retrieve-a-whole-url-via-get-or-is-there-a-better-way/page/2/#findComment-131779 Share on other sites More sharing options...
closet geek Posted November 28, 2006 Author Share Posted November 28, 2006 [quote author=The Little Guy link=topic=116598.msg475304#msg475304 date=1164746628][code]<?phpfunction get_id($url){ $end = $url; $begin = $_SERVER['SCRIPT_NAME']; $var1 = str_replace($begin,'',$end); $var2 = str_replace('?id=','',$var1); return $var2;}echo 'http://'.get_id($_SERVER['REQUEST_URI']);?>[/code]http://tzfiles.com/phpcode/entities.php?id=d-top.org/display.php?artist=orgy[/quote]Thank you so much! I slightly adapted what you posted just then, for anyone who comes across this thread in the future this is the code I ended up using to get the behaviour I wanted:[code]<?phpfunction get_id($url){ $end = $url; $begin = $_SERVER['SCRIPT_NAME']; $var1 = str_replace($begin,'',$end); $var2 = str_replace('/transfer=','',$var1); return $var2;}$myvar = get_id($_SERVER['REQUEST_URI']);?> [/code]cg :) Link to comment https://forums.phpfreaks.com/topic/28752-retrieve-a-whole-url-via-get-or-is-there-a-better-way/page/2/#findComment-131780 Share on other sites More sharing options...
The Little Guy Posted November 28, 2006 Share Posted November 28, 2006 Your Welcome! It took time but we got it! Link to comment https://forums.phpfreaks.com/topic/28752-retrieve-a-whole-url-via-get-or-is-there-a-better-way/page/2/#findComment-131783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.