Metaregistrar\EPP\eppConnection::create PHP Метод

create() статический публичный Метод

static public create ( string $configfile, boolean | false $debug = false ) : mixed
$configfile string
$debug boolean | false
Результат mixed
    static function create($configfile, $debug = false)
    {
        if ($configfile) {
            if (is_readable($configfile)) {
                $settings = file($configfile, FILE_IGNORE_NEW_LINES);
                foreach ($settings as $setting) {
                    list($param, $value) = explode('=', $setting, 2);
                    $param = trim($param);
                    $value = trim($value);
                    $result[$param] = $value;
                }
            } else {
                throw new eppException('File not found: ' . $configfile);
            }
        } else {
            throw new eppException('Configuration file not specified on eppConnection:create');
        }
        if (isset($result['interface'])) {
            $classname = 'Metaregistrar\\EPP\\' . $result['interface'];
            $c = new $classname($debug);
            /* @var $c eppConnection */
            $c->setConnectionDetails($configfile);
            return $c;
        }
        return null;
    }

Usage Example

Пример #1
0
use Metaregistrar\EPP\ptEppInfoDomainRequest;
use Metaregistrar\EPP\eppContactHandle;
use Metaregistrar\EPP\eppHost;
/*
 * This script retrieves all information for a specific domain name
 */
if ($argc <= 1) {
    echo "Usage: infodomain.php <domainname>\n";
    echo "Please enter a domain name retrieve\n\n";
    die;
}
$domainname = $argv[1];
echo "Retrieving info on " . $domainname . "\n";
try {
    // Please enter your own settings file here under before using this example
    if ($conn = eppConnection::create('pt.ini', true)) {
        // Connect to the EPP server
        if ($conn->login()) {
            $roid = '12345';
            $result = infodomain($conn, $domainname, $roid);
            $conn->logout();
        }
    }
} catch (Metaregistrar\EPP\eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}
/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domainname string
 * @return string
 */
All Usage Examples Of Metaregistrar\EPP\eppConnection::create