Page 1 of 1

getting the basic url

Posted: Fri May 28, 2004 2:39 am
by pelegk2
i have this url :

Code: Select all

<?php
http://localhost/uniprod/index.php?cont=WeightStations
?>
and i want to know only :

Code: Select all

<?php
http://localhost/uniprod/index.php
?>
how do i do that?
thnaks in advance
peleg

Posted: Fri May 28, 2004 2:52 am
by crookedgoomba
how about:

Code: Select all

preg_match("/(.*)\?/","http://localhost/uniprod/index.php?cont=WeightStations",$boo);
echo $boo[1];

Posted: Fri May 28, 2004 3:00 am
by JayBird
what about this

Code: Select all

$url = parse_url ( "http://localhost/uniprod/index.php?cont=WeightStations" );

echo $url['sheme'].$url['host'].$url['path'];

Posted: Fri May 28, 2004 3:00 am
by pelegk2
thnaks alot both of u:)

Posted: Fri May 28, 2004 3:04 am
by pelegk2
ow 1 sec!!!
how can i get the full url :
"http://localhost/uniprod/index.php?cont=WeightStations"
on the server side?withought adding $_SERVER['PHP_SELF'] to another variable and so on?

Posted: Fri May 28, 2004 3:15 am
by crookedgoomba
ummmm

Code: Select all

echo $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
maybe?!