Closed pc-partner closed 8 years ago
Make sure you are using a dnsbeEppCreateContactRequest, and not the standard eppCreateContactRequest.
The dnsbeEppCreateContactRequest contains the needed extensions
Ok changed it in: $contact = new dnsbeEppCreateContactRequest($contactinfo); But then it can’t find it: Fatal error: Class 'dnsbeEppCreateContactRequest' not found in …. Do I need to include the file seperatly?
Please use not the standard eppConnection, but dnsbeEppConnection.
$conn = new dnsbeEppConnection('');
Hi again. Tried: require('../autoloader.php');
use Metaregistrar\EPP\eppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppContactPostalInfo; use Metaregistrar\EPP\eppContact; use Metaregistrar\EPP\eppCreateContactRequest; try { if ($conn = dnsbeEppConnection::create('settings.ini',true )) { // Connect to the EPP server if ($conn->login()) { createcontact($conn, 'info@test.com', '+31.201234567', 'Domain Administration', 'Metaregistrar', 'Address 1', 'Zipcode', 'City', 'NL'); $conn->logout(); } } } catch (eppException $e) { echo "ERROR: " . $e->getMessage() . "\n\n"; }
Result: Fatal error: Class 'dnsbeEppConnection' not found in Examples\createcontact.php on line 16
Hey @pc-partner it looks like you didn't "use" dnsbeEppConnection before actually using it in your code.
You are required to "use" it or use a complete namespace when calling it. http://php.net/manual/en/language.namespaces.importing.php
try adding this to your list of "use" calls :
use Metaregistrar\EPP\dnsbeEppConnection;
You can do either: $conn = new dnsbeEppConnection(...);
or
$conn = eppConnection::create('settings.ini'); But then you must make sure that settings.ini contains: connection=dnsbeEppConnection
Hi, use Metaregistrar\EPP\dnsbeEppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppContactPostalInfo; use Metaregistrar\EPP\eppContact; use Metaregistrar\EPP\eppCreateContactRequest; use Metaregistrar\EPP\dnsEppCreateContactRequest;
With: $conn = dnsbeEppConnection::create('settings.ini',true)
And in the function: createcontact: $contact = new dnsbeEppCreateContactRequest($contactinfo);
I still get the error Fatal error: Class 'dnsbeEppCreateContactRequest' not found in.... Although I incude the dnsEppCreateContactRequest class.
Hi Pc Partner,
Please do not use $conn=dnsbeEppConnection::create
But use $conn = new dnsbeEppConnection() instead.
The correct use statement is
use Metaregistrar\EPP\dnsbeEppCreateContactRequest;
You have a typo in use Metaregistrar\EPP\dnsEppCreateContactRequest;
Thans, stupid. Again one step further but then: Fatal error: Class 'Metaregistrar\EPP\dnsbeEppCreateContactResponse' not found in xxx
If you have manually included dnsbeEppCreateContactRequest, you should do the same with dnsbeEppCreateContactResponse.
Do not forget to also make the "use" statement.
I also included: use Metaregistrar\EPP\dnsbeEppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactResponse;
But same problem: Fatal error: Class 'Metaregistrar\EPP\dnsbeEppCreateContactResponse' not found in xxx\Protocols\EPP\eppConnection.php on line 764
Did you use "new dnsbeEppConnection" or have you included the classes yourself?
In the last case you still need an include statement for dnsbeEppCreateContactResponse.
I used the new dns yes... See code:
use Metaregistrar\EPP\dnsbeEppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppContactPostalInfo; use Metaregistrar\EPP\eppContact; use Metaregistrar\EPP\eppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactResponse;
try { // Please enter your own settings file here under before using this example if ($conn = new dnsbeEppConnection(true,'settings.ini')) { // Connect to the EPP server if ($conn->login()) { createcontact($conn, 'info@test.com', '+31.201234567', 'Domain Administration', 'Metaregistrar', 'Address 1', 'Zipcode', 'City', 'NL'); $conn->logout(); } } } catch (eppException $e) { echo "ERROR: " . $e->getMessage() . "\n\n"; }
function createcontact($conn, $email, $telephone, $name, $organization, $address, $postcode, $city, $country) { $postalinfo = new eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode); $contactinfo = new eppContact($postalinfo, $email, $telephone); $contactinfo->setPassword(''); $contact = new dnsbeEppCreateContactRequest($contactinfo); if ($response = $conn->request($contact)) { //@var $response Metaregistrar\EPP\eppCreateContactResponse echo "Contact created on " . $response->getContactCreateDate() . " with id " . $response->getContactId() . "\n"; return $response->getContactId(); } else { echo "Create contact failed"; } return null; }
Hi Pc-partner
Let me try this for you and get back to you
With your code i was able to create a contact
Please make sure you have "include('autoloader.php');"
Slight alteration: $postalinfo = new eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode,eppContact::TYPE_LOC); $contactinfo->setPassword('dddede');
You MUST set a password with DNS BE
And you must specify TYPE_LOC (local) for the contact.
Hi, I include autoloader: require('../autoloader.php'); (I'm in the Examples folder). I also added your code to my project but the same error is occuring:
Fatal error: Class 'Metaregistrar\EPP\dnsbeEppCreateContactResponse' not found in xxx\Protocols\EPP\eppConnection.php on line 764
Can you attach your file that is working for you so I can compare?
Hi, Do you still want to help me? Or? Thanks for replying.
I had already deleted the test file again, but i will re-create it and send it to you.
My file looks like this now and it works. Please download the latest version of php-epp-connection, because i have made a fix because settings file was not always found correctly.
<?php use Metaregistrar\EPP\dnsbeEppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppContactPostalInfo; use Metaregistrar\EPP\eppContact; use Metaregistrar\EPP\eppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactResponse; include_once('../vendor/autoload.php');
try { // Please enter your own settings file here under before using this example if ($conn = new dnsbeEppConnection(true,'../settings/dnsbe/settings.ini')) { // Connect to the EPP server if ($conn->login()) { createcontact($conn, 'info@test.com', '+31.201234567', 'Domain Administration', 'Metaregistrar', 'Address 1', 'Zipcode', 'City', 'NL'); $conn->logout(); } } } catch (eppException $e) { echo "ERROR: " . $e->getMessage() . "\n\n"; }
function createcontact($conn, $email, $telephone, $name, $organization, $address, $postcode, $city, $country) { $postalinfo = new eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode); $contactinfo = new eppContact($postalinfo, $email, $telephone); $contactinfo->setPassword(''); $contact = new dnsbeEppCreateContactRequest($contactinfo); if ($response = $conn->request($contact)) { //@var $response Metaregistrar\EPP\eppCreateContactResponse echo "Contact created on " . $response->getContactCreateDate() . " with id " . $response->getContactId() . "\n"; return $response->getContactId(); } else { echo "Create contact failed"; } return null; }
Hi,
I've downloaded the project again and updated my files. Add a settings folder (was not there)\dnsbe\settings.ini I changed include_once('../autoload.php'); to include_once('../autoloader.php'); => In you projects folders it calls autoloader? Or am I downloading the wrong project?? Downloaded this one: https://github.com/metaregistrar/php-epp-client
I ran the code, and got: Fatal error: Class 'Metaregistrar\EPP\dnsbeEppCreateContactResponse' not found in XX\Protocols\EPP\eppConnection.php on line 768
The reason that i call autoload.php is because i am using Composer to load the php-epp-client project
If you just download the project, it is better to call autoloader.php, that is right. I will try my code again using autoloader.php instead of composer.
OK, i have used your method of include('autoloader.php') and i got exactly the same problem as you. I have solved the issue
Please download the latest version of php-epp-client and find the correct version of your script here under:
<?php use Metaregistrar\EPP\dnsbeEppConnection; use Metaregistrar\EPP\eppException; use Metaregistrar\EPP\eppContactPostalInfo; use Metaregistrar\EPP\eppContact; use Metaregistrar\EPP\eppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactRequest; use Metaregistrar\EPP\dnsbeEppCreateContactResponse; include_once('../autoloader.php');
try { // Please enter your own settings file here under before using this example if ($conn = new dnsbeEppConnection(true,'../Registries/dnsbeEppConnection/settings.ini')) { // Connect to the EPP server if ($conn->login()) { createcontact($conn, 'info@test.com', '+31.201234567', 'Domain Administration', 'Metaregistrar', 'Address 1', 'Zipcode', 'City', 'NL'); $conn->logout(); } } } catch (eppException $e) { echo "ERROR: " . $e->getMessage() . "\n\n"; }
function createcontact($conn, $email, $telephone, $name, $organization, $address, $postcode, $city, $country) { $postalinfo = new eppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode,eppContact::TYPE_LOC); $contactinfo = new eppContact($postalinfo, $email, $telephone); $contactinfo->setPassword('test'); $contact = new dnsbeEppCreateContactRequest($contactinfo); if ($response = $conn->request($contact)) { //@var $response Metaregistrar\EPP\eppCreateContactResponse echo "Contact created on " . $response->getContactCreateDate() . " with id " . $response->getContactId() . "\n"; return $response->getContactId(); } else { echo "Create contact failed"; } return null; }
That works! perfect !
Xml isn't complete. seems to be missing for dns.be