function ap_copernica_transfer($data) { require_once 'soapclient.php'; $query = mysql_query("SELECT wpc.hostname AS host, wpc.username AS user, wpc.accountname AS account, wpc.password AS pw, wpc.datenbank AS dbID\n FROM wp_copernica wpc\n WHERE wpc.id = 1"); while ($row = mysql_fetch_assoc($query)) { $coptab[] = $row; } $soapclient = new PomSoapClient($coptab[0]["host"], $coptab[0]["user"], $coptab[0]["account"], $coptab[0]["pw"]); $query = mysql_query("SELECT `datenbank` AS db FROM `wp_copernica` WHERE `id` = 1"); while ($row = mysql_fetch_assoc($query)) { $db = $row; } echo "<br /><br/><table width=\"50%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; foreach ($data as $key => $value) { $param = array("id" => $db["db"], "fields" => array("login" => $value["login"], "email" => '*****@*****.**', "registered" => $value["registered"], "bedrijfsnaam" => $value["bedrijfsnaam"], "plaats" => $value["plaats"], "straatnaam" => $value["straatnaam"], "huisnummer" => $value["huisnummer"], "postcode" => $value["postcode"], "tel" => $value["tel"], "telmob" => $value["telmob"], "geslacht" => $value["geslacht"], "firstname" => $value["firstname"], "lastname" => $value["lastname"])); $result = $soapclient->Database_createProfile($param); echo "<tr><td>{$value['email']}</td><td>"; echo !empty($result) ? "Success" : "Error"; echo "</td></tr>"; } echo "</table>"; }
} // create a collection in the database that holds a list with the names of // the children for each person in the database $collection = $soapclient->Database_createCollection(array('id' => $database->id, 'name' => 'Children')); // show what we are doing if ($verbose) { echo "create collectionfield name\n"; } // there should be one field in the collection $soapclient->Collection_createField(array('id' => $collection->id, 'name' => 'Name', 'display' => true)); // show what we are doing if ($verbose) { echo "create profile piet papier\n"; } // Create the first profile in the main database $profile1 = $soapclient->Database_createProfile(array('id' => $database->id, 'fields' => array('FirstName' => 'Piet', 'LastName' => 'Papier', 'Email' => '*****@*****.**'))); // show what we are doing if ($verbose) { echo "create subprofile paultje\n"; } // Piet has one child $child1 = $soapclient->Profile_createSubProfile(array('id' => $profile1->id, 'collection' => $soapclient->toObject(array('id' => $collection->id)), 'fields' => array('Name' => 'Paultje'))); // show what we are doing if ($verbose) { echo "create profile ed emmer\n"; } // Create the second profile $profile2 = $soapclient->Database_createProfile(array('id' => $database->id, 'fields' => array('FirstName' => 'Ed', 'LastName' => 'Emmer', 'Email' => '*****@*****.**'))); /** * Example 2 * In this example we show how to retrieve information about a profile