开发者

Auto click macro by using php

I'm using some macro recorder programs for auto cli开发者_JAVA技巧cking. These kinds of programs are made with Visual Basic, C++, etc., but I'd like to write one in PHP.

I'm loading a remote website by using PHP's cURL implementation. I'd like the PHP script to click exact mouse positions (for example: x:345px y:234px), wait for 15 seconds, then repeat.

Is this possible in PHP? If so, which php functions should I use?


Check out Selenium IDE a Firefox extension to play and simple record test cases. It supports also to click on a specific coordinate.

Selenium command ClickAt


PHP is a server-side language. It doesn't "click" - as it does not ever render the remote page, cURL just downloads it. If you're looking to automate such tasks, Selenium (an extension to Firefox) would probably be a better choice.

If you only need to simulate the requests that a browser is making (i.e. no JS interactions needed), you could watch them using Fiddler or Wireshark, then make the same requests using cURL. As long as the headers are the same, there is no simple way to distinguish them from requests made by an actual browser.


Theoretically you could do that, however it's merely impossible in practice.

In order to "simulate" the mouse clicks, you'd have parse and do at least an internal rendering of the page. This means parse (X)HTML, all the CSS and execute JavaScript. Sou you'd have to write a complete browser in PHP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜