lampstax Posted October 20, 2010 Share Posted October 20, 2010 Hey guys, I'm dealing a url that is similar to hxxp://domain/directory/?#{$id}. What I'm trying to do is extract $id from that. Its not available as a $_GET variable and $_SERVER['REQUEST_URI'] comes up as "/directory/?". Does anyone know how I could retrieve $id ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/216416-getting-url-parameter-not-as-easy-as-it-seems/ Share on other sites More sharing options...
AbraCadaver Posted October 20, 2010 Share Posted October 20, 2010 Is this the URL to the page that you are on and you're trying to get it? If so, then this is a clumsy way of doing it. The # is causing problems because it's a fragment separator for bookmarks etc in the browser. What are you hoping to get? Quote Link to comment https://forums.phpfreaks.com/topic/216416-getting-url-parameter-not-as-easy-as-it-seems/#findComment-1124638 Share on other sites More sharing options...
lampstax Posted October 20, 2010 Author Share Posted October 20, 2010 It is the URL of the page that I'm on. Agreed its not the best URL format but its what the application and I am working with. Its to link directly to a specific part of a page, however, I need to be able to detect what part that is. Any suggestions ? Quote Link to comment https://forums.phpfreaks.com/topic/216416-getting-url-parameter-not-as-easy-as-it-seems/#findComment-1124658 Share on other sites More sharing options...
AbraCadaver Posted October 20, 2010 Share Posted October 20, 2010 It is the URL of the page that I'm on. Agreed its not the best URL format but its what the application and I am working with. Its to link directly to a specific part of a page, however, I need to be able to detect what part that is. Any suggestions ? That fragment is only meaningful to the browser, so if you can't change the format of the URL, then you probably need to look at javascript. Or if you can use mod rewrite on Apache you can rewrite the URL so that the server passes the value to PHP: /?#1 becomes: /?id=1#1 for example. Quote Link to comment https://forums.phpfreaks.com/topic/216416-getting-url-parameter-not-as-easy-as-it-seems/#findComment-1124671 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.