PHP - 如何编写代码登录网站? [关闭]

I would like to write a PHP script that will go to a website, enter my userid and password, and retrieve data. What PHP functions or classes can I get that will do that?

I have already tried PHP file_get_contents, which works great except it does not submit userids and passwords. Then I started looking at cURL, but was not sure if that is the best way to go.

Thank you