metaregistrar / php-epp-client

Object-oriented PHP EPP Client
https://www.metaregistrar.com/docs/
MIT License
214 stars 160 forks source link

contact #33

Closed karborator closed 8 years ago

karborator commented 8 years ago

Hi , I'm wondering how can I get a contact , some example if possible please. Thanks

metaregistrar commented 8 years ago

To info a domain contact, you can use $info = new eppInfoContactRequest(new eppContactHandle($contactid));

If you then send that info to the registry, it will return all contact information for that $contactid

karborator commented 8 years ago

Thanks will test it :)

karborator commented 8 years ago

"objuri": null, "exturi": null, "xpathuri": { "urn:ietf:params:xml:ns:domain-1.0": "domain", "urn:ietf:params:xml:ns:contact-1.0": "contact", "urn:ietf:params:xml:ns:host-1.0": "host", "urn:ietf:params:xml:ns:epp-1.0": "epp" }, "language": null, "version": null, "defaultnamespace": null, "publicnamespace": "urn:ietf:params:xml:ns:epp-1.0"

metaregistrar commented 8 years ago

I am not sure what you mean with this.

karborator commented 8 years ago

This was the response I got on executing:

        $conn = $this->getEppClient();
        $infoRequest = new eppInfoContactRequest(new eppContactHandle('#####'));
        infoContactResponse =  $conn->writeandread($infoRequest);
metaregistrar commented 8 years ago

Your request looks fine.

After that, you can do

echo $infoContactResponse->saveXML();

to see the response from the registry.

To use the $infoContactResponse in your IDE, use /* @var $infoContactResponse Metaregistrar\EPP\eppInfoContactResponse */

After this line your IDE knows how to handle the object and you can retrieve variables.

karborator commented 8 years ago
           <?xml version="1.0" encoding="utf-8"?>
            <epp xmlns:obj="urn:ietf:params:xml:ns:obj-1.0" xmlns="urn:ietf:params:xml:ns:epp-1.0">
            <response>
             <result code="2003">
              <msg>Required paramater missing</msg>

            </result>
          <trID></trID>  
          </response>
          </epp>
metaregistrar commented 8 years ago

In that case you need to review the manual and see what parameters they require.

If you want to know what you have sent to the registry, use echo $info->saveXML();

This output you can compare with the example documentation of ficora.fi

karborator commented 8 years ago

Yes dis is from saveXML i forgot to say that

karborator commented 8 years ago

Interesting I got more xml if debug mode is activated . Its like saveXML shows the last response from the trace

karborator commented 8 years ago
<?xml version="1.0" encoding="utf-8"?>
<epp xmlns:obj="urn:ietf:params:xml:ns:obj-1.0" xmlns="urn:ietf:params:xml:ns:epp-1.0">
    <response>
        <result code="2003">
            <msg>Required paramater missing</msg>

        </result>
        <trID></trID>

    </response>
</epp>
==== LOG ====-----CONNECT-----2016-04-22 16:30:45-----
Connection made
-----END-----2016-04-22 16:30:45-----

-----READ-----2016-04-22 16:30:49-----
Reading next: 1065 bytes
-----END-----2016-04-22 16:30:49-----

-----WRITE-----2016-04-22 16:30:49-----

<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0">
    <command>
        <login>
            <clID>E55</clID>
            <pw>
                <![CDATA[#######]>
            </pw>
            <options>
                <version>1.0</version>
                <lang>en</lang>

            </options>
            <svcs>
                <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
                <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
                <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>

            </svcs>

        </login>
        <clTRID>#######</clTRID>

    </command>
</epp>

-----END-----2016-04-22 16:30:49-----

-----WRITE-----2016-04-22 16:30:49-----
Writing: 567 + 4 bytes
-----END-----2016-04-22 16:30:49-----

-----READ-----2016-04-22 16:30:54-----
Reading next: 349 bytes
-----END-----2016-04-22 16:30:54-----

-----READ-----2016-04-22 16:30:54-----

<?xml version="1.0" encoding="utf-8"?>
<epp xmlns:obj="urn:ietf:params:xml:ns:obj-1.0" xmlns="urn:ietf:params:xml:ns:epp-1.0">
    <response>
        <result code="1000">
            <msg>Command completed successfully</msg>

        </result>
        <trID>
            <clTRID>#######</clTRID>
            <svTRID>#######</svTRID>

        </trID>

    </response>
</epp>

-----END-----2016-04-22 16:30:54-----

-----WRITE-----2016-04-22 16:30:54-----

<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0">
    <command>
        <info>
            <contact:info>
                <contact:id>#######</contact:id>

            </contact:info>

        </info>
        <clTRID>#######</clTRID>

    </command>
</epp>

-----END-----2016-04-22 16:30:54-----

-----WRITE-----2016-04-22 16:30:54-----
Writing: 356 + 4 bytes
-----END-----2016-04-22 16:30:54-----

-----READ-----2016-04-22 16:30:55-----
Reading next: 264 bytes
-----END-----2016-04-22 16:30:55-----

-----READ-----2016-04-22 16:30:55-----

<?xml version="1.0" encoding="utf-8"?>
<epp xmlns:obj="urn:ietf:params:xml:ns:obj-1.0" xmlns="urn:ietf:params:xml:ns:epp-1.0">
    <response>
        <result code="2003">
            <msg>Required paramater missing</msg>

        </result>
        <trID></trID>

    </response>
</epp>

-----END-----2016-04-22 16:30:55-----
metaregistrar commented 8 years ago

I don't know the requirements of the registry - maybe they require an additional parameter?

karborator commented 8 years ago

I found this at some documentation.Idea how to implement it ?

5.2 Info Based on RFC 5733. Deviations from RFC: • Authorization is derived from object sponsorship. • If the requestor is not the object sponsor, the requestor will receive a stripped response, where the name identifier and object sponsor identifier are returned.

Example request:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
 <command>
 <info>
 <contact:info xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
 <contact:id>sh8013</contact:id>
 <contact:authInfo>
 <contact:pw>2fooBAR</contact:pw>
 </contact:authInfo>
 </contact:info>
 </info>
 <clTRID>ABC-12345</clTRID>
 </command>
</epp> 
metaregistrar commented 8 years ago

But that is a contact:check command you are referring to, not contact:info

A contact:check command goes like this:

$checkRequest = new eppCheckContactRequest(new eppContactHandle('#####'));

karborator commented 8 years ago

Checkout again , I just edit the last post . Thanks

karborator commented 8 years ago

Hello , I just found out that I should provice authInfo , but want to ask how to set to the request info ? Example

     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
 <command>
 <info>
 <contact:info xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
 <contact:id>sh8013</contact:id>
 <contact:authInfo>
 <contact:pw>2fooBAR</contact:pw>
 </contact:authInfo>
 </contact:info>
 </info>
 <clTRID>ABC-12345</clTRID>
 </command>
</epp>

Currently

    $conn = $this->getEppClient();
        $infoRequest = new eppInfoContactRequest(new eppContactHandle('XXXX'));
        $infoContactResponse = $conn->writeandread($infoRequest);
        echo $infoRequest->saveXML();
        exit;
         <?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0">
    <command>
        <info>
            <contact:info>
                <contact:id>XXXX</contact:id>
            </contact:info>
        </info>
        <clTRID>XXXXX</clTRID>
    </command>
</epp>
metaregistrar commented 8 years ago

You can use $infoRequest->setPassword('xxxxxxx'); to set auth info for the request.

karborator commented 8 years ago

Fatal error: Uncaught Error: Call to undefined method Metaregistrar\EPP\eppInfoContactRequest::setPassword() in

I think it should be set to the $conn .. ? Or I should pass eppContact instead of eppContactHandle ?

metaregistrar commented 8 years ago

You are right, the password should be set to eppContactHandle

I have added this to the code, since it was missing.

Correct call is now: $contact = new Metaregistrar\EPP\eppContactHandle($contactid); $contact->setPassword('foobar'); $info = new Metaregistrar\EPP\eppInfoContactRequest($contact);