PHP code example of xdc3 / php

1. Go to this page and download the library: Download xdc3/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/ */

    

xdc3 / php example snippets


Test.php


//path configuration
\SDK\XRC20SDK;

//Creating a Objects to call the functions of XRC20 and Create a wallet for the User
$obj1 = new XRC20SDK();

//Name func :-
var_dump($obj1->getName($contractAddress));

//GetApprove func:-
var_dump($obj1->getApprove($contractAddress,$ownerAddress,$ownerPrivateKey,$spenderAddress,$tokenAmount));

//TransferFrom func :-
var_dump($obj1->transferFrom($contractAddress,$ownerAddress,$spenderAddress,$spenderPrivateKey,$recieverAddress,$tokenAmount));

//TransferXdc func :-
$obj1->transferXdc($contractAddress,$senderAddress,$senderPrivateKey,$recieverAddress,$xdcAmount);
var_dump($obj1);

//CreateWallet func:-
$obj3 = new createXDCWallet();
$obj3->createWallet();
 


//ex :-//path configuration
721\SDK\XRC721;

//Create a Object
$obj2-> new XRC721();

//Name func :-
var_dump($obj2->getName($contractAddress));

//Symbol func :-
var_dump($obj2->getSymbol($contractAddress));

//TransferOwnership
var_dump($obj2->transfer($contractAddress,$ownerAddress,$recieverAddress,$tokenId,$approvedPrivateKey));