/** * This method request registry for information about contact * @access public * @param Contact $contact * @version GetRemoteContactResponse */ public function GetRemoteContact(Contact $contact) { $Resp = $this->Request('GET CONTACT INFO', array('CONTACTID' => $contact->CLID)); $status = $Resp->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $Ret = new GetRemoteContactResponse($status, $Resp->ErrMsg); if ($Ret->Succeed()) { $d = $Resp->Data; $fields = array('firstname' => $d['FNAME'], 'lastname' => $d['LNAME'], 'org' => $d['ORGANIZATION'], 'street1' => $d['ADDRESS1'], 'street2' => $d['ADDRESS2'], 'city' => $d['CITY'], 'sp' => $d['PROVINCE'], 'pc' => $d['POSTAL CODE'], 'cc' => $d['COUNTRY'], 'voice' => $d['PHONE'], 'email' => $d['EMAIL']); foreach ($fields as $k => $v) { $Ret->{$k} = $v; } } return $Ret; }
/** * This method request registry for information about contact * @access public * @param Contact $contact * @version GetRemoteContactResponse */ public function GetRemoteContact(Contact $contact) { $params = array('id' => $contact->CLID); $response = $this->Request("contact-info", $params); $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $ret = new GetRemoteContactResponse($status, $response->ErrMsg, $response->Code); if ($ret->Succeed()) { $ContactInfo = $response->Data->response->resData->children($this->XmlNamespaces['contact']); $ContactInfo = $ContactInfo[0]; $PostalInfo = $ContactInfo->postalInfo[0]; $ret->CLID = (string) $ContactInfo->id[0]; $ret->clID = (string) $ContactInfo->clID[0]; $ret->crID = (string) $ContactInfo->crID[0]; $ret->name = (string) $PostalInfo->name[0]; $ret->org = (string) $PostalInfo->org[0]; $ret->street1 = (string) $PostalInfo->addr[0]->street[0]; $ret->street2 = (string) $PostalInfo->addr[0]->street[1]; $ret->city = (string) $PostalInfo->addr[0]->city[0]; $ret->sp = (string) $PostalInfo->addr[0]->sp[0]; $ret->pc = (string) $PostalInfo->addr[0]->pc[0]; $ret->cc = (string) $PostalInfo->addr[0]->cc[0]; $ret->voice = (string) $ContactInfo->voice[0]; $ret->fax = (string) $ContactInfo->fax[0]; $ret->email = (string) $ContactInfo->email[0]; $type = $response->Data->xpath('//dnslu:contact/dnslu:type'); $ret->type = (string) $type[0]; if ($ret->type == 'holder_pers' || $ret->type == 'holder_org') { $ret->isorg = (string) (int) ($ret->type == 'holder_org'); } // Discloses $disclose_list = array(); if ($xpath_result = $response->Data->xpath('//dnslu:disclose/dnslu:*[@flag=1]')) { foreach ($xpath_result as $Disclose) { $disclose_list[$Disclose->getName()] = 1; } } if ($xpath_result = $response->Data->xpath('//dnslu:disclose/dnslu:*[@flag=0]')) { foreach ($xpath_result as $Disclose) { $disclose_list[$Disclose->getName()] = 0; } } foreach ($disclose_list as $name => $showIt) { $ret->SetDiscloseValue($name, $showIt); } } return $ret; }
/** * Get contact info by ID * @access public * @param string $CLID Contact registry ID * @return array Contact info. See XML:config/contacts * @version v1000 */ public function GetRemoteContact(Contact $contact) { $params = array('id' => $contact->CLID); $response = $this->Request("contact-info", $params); $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED; $resp = new GetRemoteContactResponse($status, $response->ErrMsg, $response->Code); if ($response->Succeed) { $ContactInfo = $response->Data->response->resData->children("urn:ietf:params:xml:ns:contact-1.0"); $disclose_f1 = $ContactInfo[0]->xpath("contact:disclose[@flag = 1]"); if ($disclose_f1[0] instanceof SimpleXMLElement) { $tags = $disclose_f1[0]->children("contact", true); $fields = array_keys((array) $tags); foreach ($fields as $field) { $resp->SetDiscloseValue($field, 1); } } $disclose_f0 = $ContactInfo[0]->xpath("contact:disclose[@flag = 0]"); if ($disclose_f0[0] instanceof SimpleXMLElement) { $tags = $disclose_f0[0]->children("contact", true); $fields = array_keys((array) $tags); foreach ($fields as $field) { $resp->SetDiscloseValue($field, 0); } } $ContactInfo = $ContactInfo[0]; $PostalInfo = $ContactInfo->postalInfo[0]; $resp->CLID = (string) $ContactInfo->id[0]; $resp->AuthCode = $ContactInfo->authInfo[0] ? (string) $ContactInfo->authInfo[0]->pw[0] : ""; $resp->name = (string) $PostalInfo->name[0]; $resp->org = (string) $PostalInfo->org[0]; $resp->street1 = (string) $PostalInfo->addr[0]->street[0]; $resp->street2 = (string) $PostalInfo->addr[0]->street[1]; $resp->city = (string) $PostalInfo->addr[0]->city[0]; $resp->sp = (string) $PostalInfo->addr[0]->sp[0]; $resp->pc = (string) $PostalInfo->addr[0]->pc[0]; $resp->cc = (string) $PostalInfo->addr[0]->cc[0]; $resp->voice = (string) $ContactInfo->voice[0]; $resp->fax = (string) $ContactInfo->fax[0]; $resp->email = (string) $ContactInfo->email[0]; $resp->clID = (string) $ContactInfo->clID[0]; $resp->crID = (string) $ContactInfo->crID[0]; } return $resp; }