I have tried putting something together based on a couple of different sources, but I can't get it to work - and my php and mysql skills aren't up to the task of figuing it out (I've been trying - but don't seem to be getting anywhere).
So, here's what I've got (it's probably a mess on several levels by now):
Code: Select all
<?php
$db_name = "xxxxxx";
$db_host = "xxxxxx";
$db_user = "xxxxxxx";
$db_pass = "xxxxxX";
for ($user_id = 1;
$db = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_name,$db);
$result = mysql_query("SELECT u.email AS `email`, c.firstname AS `firstname`, c.lastname AS `lastname` FROM mos_comprofiler AS c JOIN mos_users AS u USING(u.id = c.user_id)",$db);
while ($row = mysql_fetch_row($result))
{
$XMLpath = './';
$email = $row['email'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
function WriteToXML($email,$firstname,$lastname,$XMLpath)
{
$filename = time();
$fp = fopen("$XMLpath$filename", "a");
$XML = '<?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>';
$XML .= "
<key>defaultElectronicAddress.url</key>
<string>$email</string>
<key>firstname</key>
<string>$firstname</string>
<key>lastname</key>
<string>$lastname</string>
</dict>
</plist>";
$write = fputs($fp, $XML);
fclose($fp);
}
// end write to xml file
}
$user_id++);
?>Thanks!
Scott