DNS : get 'id' from active domains: Code: // Create the SOAP Client $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1)); try { // Login to the remote server if ( $session_id = $client->login($username,$password) ) { echo 'Logged into remote server sucessfully ('.$ip.').<br />'; echo 'SessionID is : '.$session_id.'<br />'; } // find ACTIVE domains on server $domains = $client->dns_zone_get( $session_id, array('active' => 'Y', 'server_id' => $server1_id) ); foreach ( $domains as $key => $value ) { // get client_id $client_id1 = $client->client_get_id($session_id, $domains[$key]['sys_userid']); // get SOA $input = $client->dns_a_get( $session_id, array('name' => $domains[$key]['origin'], 'type' => 'A', 'active' => 'Y') ); foreach ( $input as $k => $v) { $id = $input[$k]['id']; } } // logout if ( $client->logout($session_id) ) { echo "<br />".'Logged out sucessfully <br />'."<br />"; } } catch (SoapFault $e) { echo $client->__getLastResponse(); die('SOAP Error: '.$e->getMessage()); } Now I would like to create a function that updates 'serial' with this 'id'. So I created the function : Code: function NewSerial($session_id, $id) { $dns_record = $client->dns_a_get( $session_id, $id ); // <-- PHP FATAL ERROR OBJECT $serial_now = date('Ymd')."01"; $serial_old = $dns_record['serial']; if ( $serial_now>$serial_old ) { $serial_new = $serial_now; } else { $serial_new = $serial_old + 1; } return $serial_new; } and I try to call it like this: Code: $client_id1 = $client->client_get_id($session_id, $domains[$key]['sys_userid']); // get SOA $input = $client->dns_a_get( $session_id, array('name' => $domains[$key]['origin'], 'type' => 'A', 'active' => 'Y') ); foreach ( $input as $k => $v) { $id = $input[$k]['id']; $serial_new = NewSerial($session_id, $id); } But I get PHP error: Code: PHP Fatal error: Call to a member function dns_a_get() on a non-object What would be a proper way to archive this function ? Thanks in advance. Nicolas
Till, Just for records, here is what works: Code: function NewSerial($session_id, $id) { require 'soap_config_server2.php'; // Create the SOAP Client $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1)); $dns_record = $client->dns_a_get( $session_id, $id ); $serial_now = date('Ymd')."01"; $serial_old = $dns_record['serial']; if ( $serial_now>$serial_old ) { $serial_new = $serial_now; } else { $serial_new = $serial_old + 1; } return $serial_new; } Just had to define $client Thanks again for the help. Nicolas