PHP: get contents of a remote webpage that require authentication?
- by powerboy
I receive many emails whose contents are of the same pattern, e.g.
Name: XXX
Phone: XXX
Bio: XXX
......
I want to write a PHP script to parse these emails and save the data into a database. I tried to use file_get_contents() to get the contents of these emails.
The problem is that, it requires authentication to access to my emails. Even though I have signed into my email account on the server (localhost actually), file_get_contents() still return the webpage that prompts me to sign in.
So how to access the contents of my emails with a PHP script?
EDIT: it is a gmail account.