User ID and username outside Xenforo


I want to build a PHP page which is only visible for my forum members. Basically if a person joins the page, page will redirect to forum login. After login person can join the page. Finally I want to print user_id and username in that page. Is that possible or How I can do it?

My forum directory: /forum
My page directory: /test/page.php