Need help with user info export to xml file

18 years 1 month ago #9387 by sinemac
I'm uisng Community Builder to collect a lot of information from people who sign up for our website, and I want to be able to get the info from the database to my CRM. The CRM has an import function that is great if I have a specifically formatted xml file for each contact's info - but I don't know quite enough php or mysql to put it all together.

I'm hoping one of you with more skills than I can help out! ;)

I do have some basics to help me get started:

I need to pull the email address from the users table, and then specific fields from the comprofiler table for the same user - then pass that to the part that makes an xml file, then go get the next user record, and make a new xml file.

Here's what was given to me as a start:
[code:1]$user_id = 0;
$user_id = $StartID;
Loop(
MySQLQuery ( Query by record ID here);
### Write lead to XML File Function ###
function WriteToXML($firstname,$lastname,$email,$homephone,$more_fields,$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" "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>
<key>defaultPhone.phoneNumber</key>
<string>$homephone</string>
<key>defaultOtherFields.etc</key>
<string>$more_fields</string>
</dict>
</plist>";
$write = fputs($fp, $XML);
fclose($fp);
}

### End Write XML ###
End If($user_id == $EndID);
$RecordID = i++ [/code:1]

What the person helping me wasn't sure of was whether the loop function was correct... and what I'm not sure of is the query to get the data.

Any help would be greatly appreciated.

Thanks,
Scott

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.151 seconds

Facebook Twitter LinkedIn