Rsync on a browser does not work

I am trying to transfer files from one server to another with the code below.

rsync -avz -e "ssh -i /root/.ssh/somekey" /var/www/admin/somefiles.txt

It works just fine if I do this on putty but if I do shell_exec this code on a php page and run the page on a browser. It does not work. It returns an empty string.

I hope someone can help me with this. Thanks in advance.

Source: stackoverflow-php