Contents of /alx-src/branches/alx-web-070/include/socket_send.php
Parent Directory | Revision Log
Revision 7715 -
(show annotations)
(download)
Fri Sep 25 09:10:20 2015 UTC (9 years ago) by niro
File size: 1359 byte(s)
Fri Sep 25 09:10:20 2015 UTC (9 years ago) by niro
File size: 1359 byte(s)
-fixed a typo
1 | <? |
2 | // $address = "192.168.0.6"; |
3 | // $port = "6666"; |
4 | // |
5 | // // create and connect socket |
6 | // $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
7 | // socket_connect($sock, $address, $port); |
8 | // |
9 | // // send the message to the daemon |
10 | // //$mesg = "resolution=800x600\nquit"; |
11 | // $mesg = "resolution\nquit"; |
12 | // //$mesg = "printer\ngfxcard\nnetcard\nkeyboard\nmouse\nsound\nquit"; |
13 | // socket_write($sock, $mesg, strlen($mesg)); |
14 | // |
15 | // // close socket |
16 | // socket_close($sock); |
17 | |
18 | |
19 | /* fgets needs 'auto-detect-line-endings = On' in php.ini to detect unix CRLFs! |
20 | * see: http://www.php.net/manual/de/filesystem.configuration.php#ini.auto-detect-line-endings |
21 | */ |
22 | |
23 | // // ssl |
24 | // $fp = fsockopen("sslv3://192.168.0.6", 6666, $errno, $errstr, 30); |
25 | // if (!$fp) { |
26 | // echo "$errstr ($errno)<br />\n"; |
27 | // } else { |
28 | // $out = "resolution\n"; |
29 | // $out .= "quit\n"; |
30 | // fwrite($fp, $out); |
31 | // while (!feof($fp)) { |
32 | // echo fgets($fp, 128); |
33 | // } |
34 | // fclose($fp); |
35 | // } |
36 | |
37 | function mcore_socket_send($ip, $port, $cmd) |
38 | { |
39 | // use sslv3 |
40 | $schema = "sslv3://"; |
41 | |
42 | $fp = fsockopen($schema.$ip, $port, $errno, $errstr, 30); |
43 | if (!$fp) { |
44 | echo "$errstr ($errno)<br />\n"; |
45 | } else { |
46 | $out = "certauth 7acca14a60139d47d5ea591816991ef733b1e500\n"; |
47 | $out .= $cmd."\n"; |
48 | $out .= "quit\n"; |
49 | fwrite($fp, $out); |
50 | while (!feof($fp)) { |
51 | echo fgets($fp, 128); |
52 | } |
53 | fclose($fp); |
54 | } |
55 | } |
56 | ?> |