Jump to content

Retrieve a whole URL via GET (or is there a better way?)


closet geek

Recommended Posts

[quote author=The Little Guy link=topic=116598.msg475304#msg475304 date=1164746628]
[code]<?php
function 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]
<?php
function 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.