* http://www.sugarcrm.com/wiki/index.php?title=SOAP_in_PHP
* http://dietrich.ganx4.com/nusoap/
* http://www.beanizer.org/site/index.php/en/Articles/Sugar-CRM-integration-with-custom-PHP-applications-I.html
==First I downloaded the source ==
</source>
== Setting Records ==
<source lang="php">
// read in our data from source CSV file format
$arrData = file('./account_contact_list.csv');
$separator = ',';
// initialize an array to hold structured data; we'll determine what columns we want and map our data
$leadData = array();
// take the first (header) row off the CSV file
$arrFields = explode($separator, array_shift($arrData));
// flipping the array gives us the integer value we need defined by it's name
// in other words, we now have an associative array of integers
$fieldKeys = array_flip($arrFields);
// break up our records
foreach ($arrData as $k => $v) {
$arrData[$k] = explode($separator, $v);
}
// insert our records
foreach ($arrData as $record) {
$set_entry_params = array(
'session' => $session_id,
'module_name' => 'Accounts',
'name_value_list'=>array(
array('name'=>'name', 'value'=>$record[$fieldKeys['Company Name']]), // required
array('name'=>'industry', 'value'=>$record[$fieldKeys['last_name']]),
array('name'=>'phone_fax', 'value'=>$record[$fieldKeys['Fax']]),
array('name'=>'billing_address_street', 'value'=>$record[$fieldKeys['Address']]),
array('name'=>'billing_address_city', 'value'=>$record[$fieldKeys['City']]),
array('name'=>'billing_address_state', 'value'=>$record[$fieldKeys['State']]),
array('name'=>'billing_address_postalcode', 'value'=>$record[$fieldKeys['Zip Code']]),
array('name'=>'billing_address_country', 'value'=>$record[$fieldKeys['Country']]),
array('name'=>'description', 'value'=>$record[$fieldKeys['Notes']]),
array('name'=>'phone_office', 'value'=>$record[$fieldKeys['Work Phone']]),
array('name'=>'phone_alternate', 'value'=>$record[$fieldKeys['Other Phone']]),
array('name'=>'email', 'value'=>$record[$fieldKeys['Email']]),
array('name'=>'website', 'value'=>$record[$fieldKeys['website']]),
array('name'=>'employees', 'value'=>$record[$fieldKeys['employees']]),
array('name'=>'ticker_symbol', 'value'=>$record[$fieldKeys['ticker_symbol']]),
array('name'=>'assigned_user_id', 'value'=>$user_guid)
)
);
$result = $soapclient->call('set_entry',$set_entry_params);
}
</source>
== Some Issues discovered ==