Connecting to Salesforce via the API using PHP can sometimes cause a headache when trying to process a large set of data. Processing data in some sort of bulk upload can help speed up your scripts. Instead of sending one record a time to salesforce using the PHP toolkit, you should change your insert/update/upsert script to process 200 records at one time. This is done by creating a multidimensional array with your data. This can be easily accomplished by using simple array function already built into PHP called PHP: array_push - Manual
Example 261. array_push() example (From Php.net):
PHP Code:
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
The above example will output:
Array
(
[0] => orange
[1] => banana
[2] => apple
[3] => raspberry
)
PHP Code:
$sql = "SELECT Id
FROM salesforce_local_table"
//Using ADOdb Datbase abstraction layer
$recordSet = $conn->Execute($sql);
// Set up Array variable
$all_fields = array();
$i = 0;
The maximum amount of records that can be processed at one time is 200, if you increase the variable that processes to more than 200, your update will fail. The best advice that I can give you is to create a developers instance of salesforce and then create objects that mirror your live organization's instance to run tests on the data insert, update, or upsert. This is the only way that you can test to see if the data is being updated and your script is working properly.
I would also recommend that you install some verison of a WAMP server, which is a server bundle for windows. I currently use Apache2Triad's PHP 5 version. Another good application for PHP development that I use is Nusphere PHP IDE, which allows you to step through your code line by line and view the variables and their values, it is an oustanding piece of software and is totally worth the amount it costs.
Bookmarks