Question: I'd like to get just the username in the url, for example www.blank.com/username

The curl script I'm using returns the full url. I just want the user name here's the script.

```
<?php
 function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .=       $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  }
 return $pageURL;
}
?>
 <?php
  echo curPageURL();
?>

```

Answer: 
You can use the [`basename`](http://php.net/manual/en/function.basename.php) function:

```
$pageName = basename($_SERVER["REQUEST_URI"]);

```
You should find the first /-character of the url (after http://) and get the substr from there.
On the page where you got the script from, there's an example on how to do it: <http://www.webcheatsheet.com/PHP/get_current_page_url.php>

Would be something like this:

```
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);

```