By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

url of pop up

pradeepjain
100+
P: 563
hii guys,

we usually get url's in php by "REQUEST_URI" ..but how do we get the url of dynamic urls like this /abstract?ID=$i ..here the $i wll be changing according to php script...how to finding matching cases...
any suggestion on this.


Thanks,
pradeep.
Dec 29 '07 #1
Share this Question
Share on Google+
7 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Pradeep.

It varies depending on your OS, but if $_SERVER['REQUEST_URI'] doesn't include variables, you might have better luck with $_SERVER['PHP_SELF'].

Alternatively, you can do this:
Expand|Select|Wrap|Line Numbers
  1. $url = $_SERVER['REQUEST_URI'] . http_build_query($_GET);
  2.  
Dec 31 '07 #2

pradeepjain
100+
P: 563
Heya, Pradeep.

It varies depending on your OS, but if $_SERVER['REQUEST_URI'] doesn't include variables, you might have better luck with $_SERVER['PHP_SELF'].

Alternatively, you can do this:
Expand|Select|Wrap|Line Numbers
  1. $url = $_SERVER['REQUEST_URI'] . http_build_query($_GET);
  2.  






heya,
see the url is something lke www.abc.com/abstract?id=1 ok..
how to fetch only www.abc.com/abstract and leave the ?id=1....

Thanks,
Pradeep
Jan 2 '08 #3

pbmods
Expert 5K+
P: 5,821
Heya, Pradeep.

Try print_r($_SERVER) to see if you can isolate this value.
Jan 2 '08 #4

pradeepjain
100+
P: 563
Heya, Pradeep.

Try print_r($_SERVER) to see if you can isolate this value.

hii ,

Tht also did not generate the output tht i needed...any other idea.

Thanks ,
pradeep
Jan 3 '08 #5

pbmods
Expert 5K+
P: 5,821
Heya, Pradeep.

You might be able to get away with doing this:
Expand|Select|Wrap|Line Numbers
  1. $pos = strpos($_SERVER['REQUEST_URI'], '?');
  2. if( $pos )
  3. {
  4.     $url = substr($_SERVER['REQUEST_URI'], 0, $pos);
  5. }
  6. else
  7. {
  8.     $url = $_SERVER['REQUEST_URI'];
  9. }
  10.  
Jan 3 '08 #6

pradeepjain
100+
P: 563
Hey pbmods,
Thanks for tht code....Tht worked as a miracle for me..


Thanks,
Pradeep
Jan 8 '08 #7

P: 32
try this
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.       $_SERVER['FULL_URL']= "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
  3.       if($_SERVER['QUERY_STRING'])
  4.       {
  5.          $_SERVER['FULL_URL'].='?'.$_SERVER['QUERY_STRING'];
  6.       }
  7. ?>
Jan 8 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.