PHP code example of 1000nettles / factom-api-php

1. Go to this page and download the library: Download 1000nettles/factom-api-php 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/ */

    

1000nettles / factom-api-php example snippets




$url = 'http://localhost:8088/v2';
$adapter = new FactomAPIAdapter($url);

$url = 'https://localhost:8088/v2';
$certLocation = '~/.factom/m2/factomdAPIpub.cert';
$adapter = new FactomAPIAdapter($url, $certLocation);

$url = 'https://localhost:8088/v2';
$username = 'user';
$password = 'password';
$adapter = new FactomAPIAdapter($url, null, $username, $password);

$method = 'POST';
$result = $adapter->call('transaction', $method, array('hash' => '64251aa63e011f803c883acf2342d784b405afa59e24d9c5506c84f6c91bf18b'));

$method = 'GET';
$result = $adapter->call('address', $method, array('address' => 'FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q'));