Obama '08

               
   

Go Back   Mike Simonds > Salesforce > Salesforce PHP Tutorials

This is a discussion on Salesforce PHP 3 within the Salesforce PHP Tutorials forums, part of the Salesforce category; Connecting to Salesforce via the API using PHP can sometimes cause a

Reply
 
LinkBack Thread Tools Rate Thread
  #1  
Old 05-18-2007, 08:39 AM
Administrator
 
Join Date: May 2007
Posts: 248
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike
Salesforce PHP 3

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



Powered by vBulletin


SEO by vBSEO 3.2.0 RC8 ©2008, Crawlability, Inc.

1 2 3 4 5