I am trying to view the source code of a website which needs Google login.
I am logged into my Google account on Chrome, and I am running the php file on Chrome using XAMPP.
My code:
<?php
$homepage = file_get_contents('http://www.example.com/');
echo $homepage;
?>
However, when I echo it shows me a webpage that says I am not logged in, although I am logged in. What am I doing wrong?
EDIT: I understand it is because I don't have the cookies when I run it using XAMPP. How do I run it on Chrome so that it will use Chrome's cookies?
You have to log in with your PHP-Server before you can fetch the loggedin-website. This is achievable by using CURL with active cookiefiles.
(You have to do all the login-process within your PHP!!)
Well you start your CURL-Action with some parameters which could look quite different depending on the website-specific login process. See this image for an example: https://i.sstatic.net/uwX4x.png (very old example of some login)