I was googling a bit but coudn't find anything usefull.

Let's say I have a remote page, let's say google.com, on which I want to type something in a form, select a specific item from the dropdown menu, click a button and then extract the data from the provided page.

I would like to automate this task.

In c#, I know I can create a browser object and use it to invoke buttons on specific pages, even select the data from the drop down menus, fill in forms, ect.

Can a similar task be done using php and how?

Thank you for your time.

Andrej

有帮助吗?

解决方案

Try WWW::Mechanize for PHP package. Better yet, if you're curious to see how it works, do some reading on HTTP protocol, in particular on details of GET and POST methods.

The first part, about the drop-down and clicking, would have to be done in JavaScript, with AJAX. If you just have a form where you type something and submit, just PHP will suffice.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top