[PHP question] URL manipulation

monoVertex

I'm back!
Reaction score
460
Ok, I want to get a certain part of the URL: everything, except the php fraction.

Example: URL is 'http://www.moisiltl.110mb.com/index.php?l=ro'

I want to get the 'http://www.moisiltl.110mb.com/index.php'.

Any help appreciated.

PS: I searched google and found ways to get the php fraction, or the 'index.php?l=ro', but not what I want :(.
 

monoVertex

I'm back!
Reaction score
460
By PHP fraction I meant the '?l=ro' or w/e, after the 'blabla.php'.

If that code you gave me returns me the entire link, without that "PHP fraction" (I found this label on a website, dunno if it's correct), then that's what I was looking for. Thanks!
 

mase

____ ___ ____ __
Reaction score
154
Its called a URI I believe.
And the only way I can think to hide the URI is use a form with method="post" for your links ><
 

monoVertex

I'm back!
Reaction score
460
I don't want to hide it, I'm making a website in multiple languages and the '?l=ro' determines the language and I want to create a dynamic script, that changes a page in the same page, but with a different language, I don't want to write for each page a different script... So I need to take what is before the '?l=ro' and add to it a fraction to make another language.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Well, just the $_SERVER['PHP_SELF'] should do it already.
If you're staying on the same site, the site as such isn't needed.

And, for all practical purposes, the "?" part is the "Query".
Never seen fraction... (in that context).
You can get it with $_SERVER["QUERY_STRING"].
 

monoVertex

I'm back!
Reaction score
460
Oh, Ace you're the man! I found that 'PHP_SELF' thingie on the internet, but I passed it, because I forgot about the same server stuff. Thanks a lot!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top