i used $_SERVER[\'REMOTE_ADDR\'] and it returns client ip address (IP address from which the user is viewing the current page) but at now (and same code) it returns host ip
You should query for HTTP_X_FORWARDED_FOR first and if it isn't assigned use REMOTE_ADDR.
HTTP_X_FORWARDED_FOR
REMOTE_ADDR