[PHP help] How to make an external PHP script which logins automatically?

For example there is a input option in a certain website like example.com in the following HTML format:

Password: [INPUT TEXTBOX FOR TYPING IN PASSWORD]

Question:
-I wanna log into it through an external PHP script, how is it possible ?

More explanation:
A php script which types the password automatically into that example.com password field and retrieves data from there so that I can use that data in the php code.

Main purpose:
I wanna read an HTML file from example.com but it requires a password for accessing the data, so I wanna make the PHP script such that it logins first and then retrieves that data.

Doesn’t sound all that legal, but you could using curl or file_get_contents(),

file_get_contents() wont do the job. he needs a way to log in to the web first and then scrap the data. but he needs to log in first.

it can be done using curl unfortunately i don’t know how to

It can be done with file_get_contents, i use it when i pull a feed from another site, you just have to put the log in information before the url (don’t think it’ll work with IE though, hasn’t for some years), or through the context parameter.

Well I used curl and got into that, but it redirects me to some other page after I login.

And file_get_contents function is not working.

Sponsor our Newsletter | Privacy Policy | Terms of Service