function addRemoteServer($title, $url, $gedcom_id, $username, $password) { if (!$url || !$gedcom_id || !$username || !$password) { return null; } if (preg_match("/\\?wsdl\$/", $url) == 0) { $url .= "?wsdl"; } $serverID = $this->checkExistingServer($url, $gedcom_id); if (!$serverID) { $gedcom_string = "0 @new@ SOUR\n1 URL {$url}\n1 _DBID {$gedcom_id}\n2 _USER {$username}\n2 _PASS {$password}\n3 RESN confidential"; $service = new ServiceClient($gedcom_string); $sid = $service->authenticate(); if (PEAR::isError($sid)) { $sid = ''; } if (!$sid) { echo '<span class="error">failed to authenticate to remote site</span>'; $serverID = null; } else { if (!$title) { $title = $service->getServiceTitle(); } $gedcom_string .= "\n1 TITL {$title}"; $serverID = append_gedrec($gedcom_string); } } return $serverID; }