Re: [PHP] Calling API on Windows?
Okay, here is the error: http://hwhome.hkto.net:808/apidie.jpg I'm using CHT version of windows, but I think you should seen this window before. I've searched on google, but I find lots of ffi that != Foreign Function Interface :( I found this: http://www.cweiske.de/download/phpgtk/pear/System_WinDrives.phps which use PHP's w32api on PHP4 and use FFI on PHP5. But it provide a simple example of using ffi only, and I'm still confused on it. Please help, Thx! Ho Wang Jochem Maas wrote: HoWang Wang wrote: Hi, How can I use it? For example: [lib='user32.dll'] int MessageBoxA(int handle, char *text, char *caption, int type); How can I write this sentence? What is the format? And I want to use GetComputerNameA, what can I do? ?php $win32_idl = [lib='user32.dll'] int MessageBoxA(int handle, char *text, char *caption, int type); [lib='kernel32.dll'] int GetComputerNameA (char *lpBuffer, DWORD nSize);; $ffi = new ffi($win32_idl); $compname = ''; $r = $ffi-GetComputerNameA($compname,255); echo $r; //Debug echo $ffi-MessageBoxA(0, The Computer Name is . $compname, Test, 0); ? doesn't work, it give me an error. could you please move the roof of your house so I can see your computer monitor? (what's the error?) did you search for the error on google or yahoo or insert-favorite-search-engine? Please help, thx! Jochem Maas wrote: Hi Ho, (7 dwarfs anyone? ;-) click this link to download php4.4.2 (not the installer version) it contains the DLL your looking for: http://hk.php.net/get/php-4.4.2-Win32.zip/from/a/mirror in the event that your using php5 then w32api is no longer available - it has been replaced with fcc: http://pecl.php.net/package/ffi you can download a binary ddl (built automatically from cvs) here: http://pecl4win.php.net/ext.php/php_ffi.dll HoWang Wang wrote: Dear all, I have a question on w32api ( http://hk.php.net/manual/en/ref.w32api.php ). I'm developing a command line program with PHP on windows, and I want to call some API. But I cannot found the dll required for the w32api extension. I'm using PHP/5.0.5, does anyone have an idea? Or there is another extension can call Windows API? Thanks Ho Wang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling API on Windows?
Dear all, I have a question on w32api ( http://hk.php.net/manual/en/ref.w32api.php ). I'm developing a command line program with PHP on windows, and I want to call some API. But I cannot found the dll required for the w32api extension. I'm using PHP/5.0.5, does anyone have an idea? Or there is another extension can call Windows API? Thanks Ho Wang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling API on Windows?
Hi, How can I use it? For example: [lib='user32.dll'] int MessageBoxA(int handle, char *text, char *caption, int type); How can I write this sentence? What is the format? And I want to use GetComputerNameA, what can I do? ?php $win32_idl = [lib='user32.dll'] int MessageBoxA(int handle, char *text, char *caption, int type); [lib='kernel32.dll'] int GetComputerNameA (char *lpBuffer, DWORD nSize);; $ffi = new ffi($win32_idl); $compname = ''; $r = $ffi-GetComputerNameA($compname,255); echo $r; //Debug echo $ffi-MessageBoxA(0, The Computer Name is . $compname, Test, 0); ? doesn't work, it give me an error. Please help, thx! Jochem Maas wrote: Hi Ho, (7 dwarfs anyone? ;-) click this link to download php4.4.2 (not the installer version) it contains the DLL your looking for: http://hk.php.net/get/php-4.4.2-Win32.zip/from/a/mirror in the event that your using php5 then w32api is no longer available - it has been replaced with fcc: http://pecl.php.net/package/ffi you can download a binary ddl (built automatically from cvs) here: http://pecl4win.php.net/ext.php/php_ffi.dll HoWang Wang wrote: Dear all, I have a question on w32api ( http://hk.php.net/manual/en/ref.w32api.php ). I'm developing a command line program with PHP on windows, and I want to call some API. But I cannot found the dll required for the w32api extension. I'm using PHP/5.0.5, does anyone have an idea? Or there is another extension can call Windows API? Thanks Ho Wang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?
Curt Zirzow wrote: On Sun, Feb 12, 2006 at 10:32:27AM -0500, Mark Charette wrote: Let me give an example: on fileplanet.com, they have something so called download slot and lines. They limit the number of concurrent downloads. If there are too many users, they will disallow new user to download their files. As I know, they do it with custom HTTP server. Not so custom ... Apache has quite a few bandwidth limiting modules. I use mod_bandwidth to accomplish this. I would suggest going this method instead of trying to chisel a round wheel from a square granite rock. Curt. :( really can't do this with PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?
Curt Zirzow wrote: On Sat, Feb 11, 2006 at 12:48:50PM +0800, HoWang Wang wrote: HoWang Wang wrote: Hi all, The Zend Encoder 4.0 (beta) have a new function in the license manager which can limit the number of concurrent users. I have wriiten something to work like it. But I found a problem. My script can limit the number of concurrent running script only. When the script ends, there is some data remain in the buffer (of Apache, I think) and the client connection is still active! How can I solve this? Please help, Thanks. Regards Is it really impossible? Can I do it with Connection Handling? It is really unclear on exactly what you are doing and i have no clue what data is remaining in what buffer you think might be the problem. ?php set_time_limit(0); ignore_user_abort(true); // add 1 to the number of concurrent users // the rest of code while (!connection_aborted()) { // keep on locking } else { // release lock } ? You really dont want to do this. By doing that while loop, you will do a couple of bad things: - eating up a lot of CPU usage, of course a sleep in the loop would probably prevent cpu abuse but still not the ideal way to do it. - You will most likely run out of available slots that http has available. Curt. Let me give an example: on fileplanet.com, they have something so called download slot and lines. They limit the number of concurrent downloads. If there are too many users, they will disallow new user to download their files. As I know, they do it with custom HTTP server. PHP run very quickly pass all contents to Apache within 0.000X second. But the web server usually have to take up 1 or more seconds to send all the contents to the client. Is it possible to limit the concurrent users (including the users receiving data but the php script already finished) with PHP? Please reply, thanks to all. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?
HoWang Wang wrote: Hi all, The Zend Encoder 4.0 (beta) have a new function in the license manager which can limit the number of concurrent users. I have wriiten something to work like it. But I found a problem. My script can limit the number of concurrent running script only. When the script ends, there is some data remain in the buffer (of Apache, I think) and the client connection is still active! How can I solve this? Please help, Thanks. Regards Is it really impossible? Can I do it with Connection Handling? ?php set_time_limit(0); ignore_user_abort(true); // add 1 to the number of concurrent users // the rest of code while (!connection_aborted()) { // keep on locking } else { // release lock } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Clone of the concurrent users limit of Zend Encoder 4.0 ?
Hi all, The Zend Encoder 4.0 (beta) have a new function in the license manager which can limit the number of concurrent users. I have wriiten something to work like it. But I found a problem. My script can limit the number of concurrent running script only. When the script ends, there is some data remain in the buffer (of Apache, I think) and the client connection is still active! How can I solve this? Please help, Thanks. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can PHP works with telnet?
Hi, It's me again. I have take a look on http://www.geckotribe.com/php-telnet/ , but I think the codes are not friendly to me. So I create my own telnet class for my program. I'm going to post it here for reference. But it is made just for my program so you may have difficulty when you try to use it on a normal telnet connection. ?php class telnet { // Host var $host = '127.0.0.1'; // Port var $port = 23; // Use usleep? var $usleep = 1; // --- End of config --- // File Pointer var $fp; // This is the Telnet headers var $header1; var $header2; function telnet($host,$port) { if (!empty($host)) $this-host = $host; if (!empty($port)) $this-port = $port; $this-header1=chr(0xFF).chr(0xFB).chr(0x1F).chr(0xFF).chr(0xFB).chr(0x20).chr(0xFF).chr(0xFB). chr(0x18).chr(0xFF).chr(0xFB).chr(0x27).chr(0xFF).chr(0xFD).chr(0x01).chr(0xFF).chr(0xFB). chr(0x03).chr(0xFF).chr(0xFD).chr(0x03).chr(0xFF).chr(0xFC).chr(0x23).chr(0xFF).chr(0xFC). chr(0x24).chr(0xFF).chr(0xFA).chr(0x1F).chr(0x00).chr(0x50).chr(0x00).chr(0x18).chr(0xFF). chr(0xF0).chr(0xFF).chr(0xFA).chr(0x20).chr(0x00).chr(0x33).chr(0x38).chr(0x34).chr(0x30). chr(0x30).chr(0x2C).chr(0x33).chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0xFF).chr(0xF0). chr(0xFF).chr(0xFA).chr(0x27).chr(0x00).chr(0xFF).chr(0xF0).chr(0xFF).chr(0xFA).chr(0x18). chr(0x00).chr(0x58).chr(0x54).chr(0x45).chr(0x52).chr(0x4D).chr(0xFF).chr(0xF0); $this-header2=chr(0xFF).chr(0xFC).chr(0x01).chr(0xFF).chr(0xFC).chr(0x22).chr(0xFF).chr(0xFE). chr(0x05).chr(0xFF).chr(0xFC).chr(0x21); $this-connect(); } function sleep() { if ($this-usleep) { usleep(125000); } else { sleep(1); } } function connect() { $this-fp = fsockopen($this-host,$this-port); fputs($this-fp,$this-header1); $this-sleep(); fputs($this-fp,$this-header2); $this-sleep(); } function docmd($cmd) { fputs($this-fp,$cmd . \r); $this-sleep(); } function readresp() { do { // read line by line, or at least small chunks $output.=fread($fp, 80); $stat=socket_get_status($fp); } while($stat[unread_bytes]); $output = str_replace(\n, br, $output); echo $output; } function disconnect() { fclose($this-fp); } } ? Thanks to all the repliers. HoWang Wang wrote: Hi all, Recently I got a job to write a PHP webpage to display some infomation which have to obtain from telnet. Telnet is the only way to query the software. I have made a quick search on php.net but I can't found amy extension support telnet. Is there any way to do so? Or it is impossible with PHP but can be done with external binaries? Please help, thanks. HoWang Wong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can PHP works with telnet?
Hi all, Recently I got a job to write a PHP webpage to display some infomation which have to obtain from telnet. Telnet is the only way to query the software. I have made a quick search on php.net but I can't found amy extension support telnet. Is there any way to do so? Or it is impossible with PHP but can be done with external binaries? Please help, thanks. HoWang Wong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php