I am trying tooth and nail to create a method of copying a string of text to
the server's clipboard via php.

I have found a couple of short pieces of code to do exactly that in C, so
compiled the program and in a command prompt it works like a charm - in my
case it reads the contents of a text file and copies that to the clipboard.

I then try using a php script to execute that file using shell_exec(),
exec() and system() to no luck, every time the command:

$outpt = shell_exec("clipboard.exe") or die ("failed to execute");Would just
print out the die message.

I set about writing my own C program to copy the contents of the text file
first to the screen, and then to a char array which could then be passed to
the clipboard.

All of these self made programs could be executed by shell_exec() - so I
thought I was finally onto a winner. However it seems that I can't just pass
a char array to SetClipboardData - it has to be a block of Globally Movable
memory, which sadly I don't understand.


Is there any reason why PHP shell_exec() or other execution commands are
unable to run a program that tampers with memory? I can't say I understand..
The other question would be - how could I modify either of the exe files to
work with PHP?

Thankyou for your time and knowledge :)

clipper.php <-- php code for shell_exec commands. change which line is
commented to test the second method
clipboard.cpp <-- clipboard executable found from google, works in command
prompt but 'fails to execute' with PHP
clipper.cpp <-- clipboard executable I wrote, which doesn't actually work,
but can be executed with PHP

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to