If you're going to help, at least read the question. The poster already said
they tried that and it's not even a solution, anyhow. The "username" it
refers to in parse_url() is for URLs in the format of
> >which is stored in $http_referer (as parse_url from
> >I'm trying to extract the username (~fungae). I've
> >read the docs on parse_url(), and have tried to get
> >$http_referer[user], but it comes up with zilch. I've
> >also tried to print_r $http_referer, but I only get
> >scheme, host, path, and query. Any ideas?
Assuming $url is what you have above:
$tilde = strpos($url,"~");
$slash = strpos($url,"/",$tilde);
$length = $slash - $tilde;
$username = substr($url,$tilde,$length);
Or you can use a regular expression, but the above is probably faster.
In my tests, the first solution (using strpos) was the fastest by 35%.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php