tags:

views:

47

answers:

2

How can I convert the following link below using PHP $_SERVER or something similar?

'../members/' . urlencode($user_id) . '/images/thumbs/' . $avatar;
+1  A: 

Your question is somewhat unclear, but I think this may be what you are looking for.

$_SERVER['REQUEST_URI'];

This will give you everything in the url after the domain name.

Eg: If you request http://domain.com/sites/test/one.html

This will return /sites/test/one.html

http://php.net/manual/en/reserved.variables.server.php

Shane Reustle
+1  A: 

If I understand, you want a complete URL:

$myUrl = $_SERVER['SERVER_NAME'] . '/members/' . urlencode($user_id) . '/images/thumbs/' . $avatar;

echo "<a href='" . $myUrl . "'>" . $myUrl . "</a>";
NAVEED