Hello, I am trying to get some information from the url. Let's say I have: http://example.com/folder/test.php Is there a way where I can isolate "test" on its own? I've been looking at the $_SERVER variables but I cant find what I'm looking for. Any ideas? Thank You, Jason
Can you explain more... not sure what your asking ? Have a look here http://ie.php.net/manual/en/reserved.variables.server.php maybe you want $_SERVER['SCRIPT_FILENAME'] or perhaps your looking for <?php $content = file_get_contents('http://example.com/folder/test.php'); echo $content; ?> PHP:
I wanna get the actual name "test" not the contents of the file. So: http://example.com/folder/test.php I want to get rid of the http://example.com/folder/ and the .php so I just have test like. $var would = test
Sorry I'm still not with you.. but that could be me... where do you want this "test" word to appear ? <a href="http://example.com/folder/test.php">test</a> will appear as test on a page
lets say I have: $word = http://example.com/folder/test.php; I WANT $word TO EQUAL test!!! so if I go: echo $word; then it will print out test!
Ok with you now... Try this <?php $url = $_SERVER['PHP_SELF']; $path = explode('/',$url); $pl = count($path); $directory = $path[$pl-2]; $filename = explode('.',$path[$pl-1]); $word = $filename[0]; echo $word; ?> PHP: