Page 1 of 1
moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 8:53 am
by xerxes
hi all
first time member here.
i dont know if this can be done
is it possible to have or create a php script to
move the mouse pointer (windows) to a disired position
on a web page then left click to activate for example a hyper link ?
can some one please point me in the right direction
for the php command that can do this or a ready made
php script that can do this.
thanks you
xerxes
Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 8:59 am
by xerxes
the reason why im doing this is
a family member has disabilities
and i want to make his life a tiny bit
better by having some partial automation
when he is on the internet.
my problem is, the only language i know
is php
xerxes
Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 9:02 am
by Zoxive
PHP is server side code, it has nothing to do with real time interaction. It is called on a page load Basis.
Now with JavaScript you can get the mouse coordinates (Listen), but there is no way to control the mouse or any part of the users computer.
Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 9:28 am
by xerxes
thanks Zoxive for the quick reply
let me explain my concept a little
what i notice is he visits 1 particular website or spend
most of his time there each day. he tends to read a lot from the
site but after a few hours eye strain and fingers becomes
tired so what i thought was this.
all operations will be done localy on his machine.
first, he goes to his favorite site and begin reading
then after 45 - 60 minutes maybe java/php could move the
mouse pointer to the next topic by clicking.
i already done a few local programs for him to get his teeth
into with php but this mouse automation thingy is giving me
grief.
do you think that java script and php could be the solution here
and if so can you still point me in the right direction ?
i know this is not a java site and so im sorry
xerxes
Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 9:43 am
by John Cartwright
I think you are looking at this from the wrong angle

Your always going to find it hard to manipulate the client machine. Think of security implications if a website could control your mouse/keyboard!
Better yet,
1. capture the contents of the page using
file_get_contents(), or
cURL, or the other many file handling functions.
2. capture the next link you want to visit using regular expression (we also have a regex forum here)
3. set javascript's setTimeout to redirect to next link using the link captured in regular expression after x minutes
4. display the contents of the page you captured in step 1
Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 9:49 am
by xerxes
Jcart WOW
really you are a life saver.
i cant believe that i never thought of that my self.
i thank you so much for a solution
thank you so much.
xerxes
ps. thanks again

Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 10:45 am
by onion2k
Interesting puzzle. I think I'd approach it using Greasemonkey.
Re: moving and clicking the mouse with PHP
Posted: Tue Mar 18, 2008 1:02 pm
by Jenk
meta-refresh may also be an option.
Re: moving and clicking the mouse with PHP
Posted: Wed Mar 19, 2008 4:55 am
by xerxes
just for extra knowledge
what is Greasemonkey and how could
meta refresh help ?
thanks
xerxes
Re: moving and clicking the mouse with PHP
Posted: Wed Mar 19, 2008 5:07 am
by Chris Corbyn
xerxes wrote:just for extra knowledge
what is Greasemonkey and how could
meta refresh help ?
thanks
xerxes
Greasemonkey is a firefox extension which allows you to add JavaScript to web pages.
Re: moving and clicking the mouse with PHP
Posted: Wed Mar 19, 2008 10:10 am
by John Cartwright
I would most certainly take a look at making a Greasemonkey script, great idea!
Re: moving and clicking the mouse with PHP
Posted: Sun Mar 30, 2008 6:17 pm
by AMCH
Alternatively you could program a macro to do this.