From 298623cb91c3e7954755995ccacb1b82b613c91f Mon Sep 17 00:00:00 2001 From: Vincent Cloutier Date: Sat, 12 Mar 2016 11:04:14 -0500 Subject: [PATCH] ipfs api can now return ipfs's version number #35 --- app/class/ipfs.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/class/ipfs.class.php b/app/class/ipfs.class.php index 79ef84b..760fbcb 100644 --- a/app/class/ipfs.class.php +++ b/app/class/ipfs.class.php @@ -86,6 +86,17 @@ public function pinAdd ($hash) { return $data; } + public function version () { + + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/version"); + $data = json_decode($response, TRUE); + + return $data["Version"]; + } + private function curl ($url, $data = "") { $ch = curl_init();