php-epp-client
php-epp-client copied to clipboard
Check Balance on Switch (NIC.ch)
Hello,
I am currently playing around with this code but I don't understand how to use the checbalance function.
Here is my code
<?php
require('../autoloader.php');
use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppCheckDomainRequest;
use Metaregistrar\EPP\eppCheckDomainResponse;
echo "Checking balance";
try {
if ($conn = eppConnection::create('../settings.ini')) {
$conn->addExtension("balance-1.0", "https://www.nic.ch/epp/balance-1.0");
// Connect and login to the EPP server
if ($conn->login()) {
echo "Checking balance\n";
checkBalance($conn);
$conn->logout();
}
}
} catch (eppException $e) {
echo "ERROR: " . $e->getMessage() . "\n\n";
}
function checkBalance($conn) {
// Create request to be sent to EPP service
$check = new eppBalanceInfoRequest();
// Write request to EPP service, read and check the results
if ($response = $conn->request($check)) {
$checkResult = $response->getBalance();
echo $checkResult;
}
}
Here you can see that I load the "eppCheckDomainRequest".
However when I call eppBalanceInfoRequest using "$check = new eppBalanceInfoRequest();"
I get the following error
PHP Fatal error: Uncaught Error: Class "eppBalanceInfoRequest" not found in /RED/php-epp-client/Examples/checkbalance1.php:27
Stack trace:
#0 /RED/php-epp-client/Examples/checkbalance1.php(17): checkBalance()
#1 {main}
thrown in /RED/php-epp-client/Examples/checkbalance1.php on line 27
I am searching since a few hours now, and I would definitly love some help/guidance.
Thanks in advance.