I need to get the page source of Yii2 web page, which requires authorization.
For example, there are some posts like mysite.pro/post/123, these pages are available only for logged users. I created a view that can show posts in an editor, so I want to get the code of the post and try to get it with:
file_get_contents('http://mysite.pro/post/123',false),
However, the server returns me a 403 code.
Is there a way to get the page as a current Yii2 user?