IPFSNODEID

This commit is contained in:
fred 2021-08-12 11:32:19 +02:00
parent 6b4651d4c5
commit 6969e456c6
1 changed files with 13 additions and 2 deletions

View File

@ -9,15 +9,26 @@ if (isset($_REQUEST['phone'])) $phone = $_REQUEST['phone']; else $phone = urldec
$message = "Proposition de ". $phone ." message : ".$link;
$TIMESTAMP=system("$(date -u +%s%N | cut -b1-13)", $retval);
print_r($TIMESTAMP);
$YOU=system("ps u -C ipfs | tail -n 1 | cut -f 1 -d ' '", $retval);
// print_r($YOU);
$IPFSNODEID=system("ipfs --timeout=5s id -f='<id>\n'", $retval);
print_r($YOU);
$IPFSNODEID=system("cat"/home/".$YOU."/.zen/ipfs/.*/.ipfsnodeid", $retval);
print_r($IPFSNODEID);
// WRITE MESSAGE LOCALY
$myfile = fopen("/home/".$YOU."/astroport/www/newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $message);
fclose($myfile);
// WRITE MESSAGE TO IPFS
$myfile = fopen("/home/".$YOU."/.zen/ipfs/.$IPFSNODEID/astroport/www/newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $message);
fclose($myfile);
error_log("SEND ". $phone ." message : ".$link );
mail($to, $subject, $message, $headers);
echo "OK";