32 lines
680 B
PHP
32 lines
680 B
PHP
<?php
|
|
|
|
use Menking\Meshcore\Environment;
|
|
use Menking\Meshcore\Meshcore;
|
|
|
|
require(__DIR__ . '/../vendor/autoload.php');
|
|
|
|
if( !isset($argv[1]) ) die("{$argv[0]} <port>\n");
|
|
|
|
Environment::configure($argv[1]);
|
|
|
|
$mc = Meshcore::getInstance();
|
|
|
|
$mc->appStart("send message");
|
|
|
|
$contacts = $mc->getContacts();
|
|
|
|
echo "Found " . count($contacts) . " contacts\n";
|
|
|
|
|
|
$idx = 1;
|
|
foreach($contacts as $contact) {
|
|
echo "(" . $idx++ . ") {$contact['contact_name']} [" . substr($contact['pub_key'], 0, 6) . "]\n";
|
|
}
|
|
|
|
$choice = readline("\nPlease select contact to attempt remote login: ");
|
|
$contact = $contacts[$choice - 1];
|
|
|
|
$resp = $mc->getAdvertPath($contact['pub_key']);
|
|
print_r($resp);
|
|
|