mirror of
https://codeberg.org/reflect/reflect-client-php.git
synced 2025-09-13 17:43:42 +02:00
wip: 2024-03-19T16:51:47+0100 (1710863507)
This commit is contained in:
parent
1d55090a31
commit
a444901169
1 changed files with 0 additions and 32 deletions
32
client
32
client
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use \Reflect\Client;
|
|
||||||
use \Reflect\Method;
|
|
||||||
use \Reflect\Connection;
|
|
||||||
|
|
||||||
if (php_sapi_name() !== "cli") {
|
|
||||||
die("Must be run from command line\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once __DIR__ . "/src/Reflect/Client.php";
|
|
||||||
|
|
||||||
// Require 3 to 4 arguments
|
|
||||||
if ($argc < 4 || $argc > 4) {
|
|
||||||
$arglen = $argc - 1;
|
|
||||||
exit("Expected 3 to 4 arguments (got ${arglen}): <reflect_socket_path> <endpoint> <http_method> [payload]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to the socket server
|
|
||||||
$client = new Client($argv[1], null, Connection::AF_UNIX);
|
|
||||||
|
|
||||||
// Get endpoint, method, and optional payload
|
|
||||||
$args = $argv;
|
|
||||||
array_shift($args);
|
|
||||||
array_shift($args);
|
|
||||||
|
|
||||||
// Restore enum from argument
|
|
||||||
$args[1] = Method::from(strtoupper($args[1]));
|
|
||||||
|
|
||||||
// Call endpoint and echo result
|
|
||||||
$call = $client->call(...$args);
|
|
||||||
echo json_encode($call) . "\n";
|
|
Loading…
Add table
Reference in a new issue