commit 67e10a3949fb1ac14d4337ce028ddb08830af8ca
parent d315a413c7b175ecc597a8c83327660f4e0d11fb
Author: ThomasV <thomasv@gitorious>
Date: Wed, 9 Nov 2011 21:44:34 +0100
php server
Diffstat:
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/server/electrum.php b/server/electrum.php
@@ -0,0 +1,23 @@
+<?
+ $query = $_GET['q']. "#";
+
+ $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ if ($socket === false) {
+ echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
+ }
+
+ $result = socket_connect($socket, 'ecdsa.org', 50000);
+ if ($result === false) {
+ echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
+ }
+
+ socket_write($socket, $query, strlen($query));
+
+ $buf='ex';
+ if (false == ($bytes = socket_recv($socket, $buf, 2048, MSG_WAITALL))) {
+ echo "socket_recv() failed; reason: " . socket_strerror(socket_last_error($socket)) . "\n";
+ }
+ socket_close($socket);
+ echo $buf;
+
+?>