PHP code example of g33kme / ipfs
1. Go to this page and download the library: Download g33kme/ipfs library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
g33kme / ipfs example snippets
/*
* You have to setup some Settings
*/
// Define your URL to your IPFS NODE API, with version, but NO ending slash!
define('IPFS_API', 'http://<IP4-SERVER-ADDRESS>:5001/api/v0');
// Check version of your IFPS Node
$res = IPFS::version();
print_r($res);
//Add a file to your IFPS Node and get a hash back
$res = IPFS::add(array(
'file' => 'path/to/your/geekme.png'
));
print_r($res);
echo $res[Name].' was uploaded to IPFS with hash: '.$res[Hash];