+ Start a Discussion
Tran ManTran Man 

PHP Toolkit v11

The PHP toolkit provides you an easy way to make Web service API method calls.

Newly supported or enhanced in this release are:
* Metadata API
* Email
* Merge
* Workflow
* EmptyRecycleBin
* Proxy Server
* LoginScopeHeader
* Header Options at the Connection Level

Click this link to enjoy.  Be sure to check out the extensive Samples section as well.

Nice! A big thank you from me. Nice work on all the samples too, the previous version was very lacking in that aspect. Looking forward to using this!
Paul GreggPaul Gregg
Thanks Nick,

I wonder if you could clarify the status of this (and other) toolkits within SFDC.  As you can appreciate - there was quite a significant delay between your Dreamforce demo and annoucement "within the week"  and availability of this toolkit.

I asked our premium support rep and got this response:
"unfortunately the tool kits are not supported products, as per our main application. We are unable to give specific dates on releases of new updates. I do have an email in to the developer team to see if they can provide any further insight."

Which then leads us to question the specific toolkits or use of APIs with our SFDC implementation.  I would love you to clarify SFDC's position on this.

Tran ManTran Man
This toolkit is not supported by the official support channels.  Although we can't guarantee support, we (the DFC team) will try our best to help out wherever we can.  Having said that, the delay was unfortunately the result of other projects that took priorities.

Given the popularity of PHP and the fact we use the PHP toolkit quite extensively internally, we will continue to maintain and update it.  On another note, I know of several developers that went ahead and extended the toolkit with new API calls and other functionalities which we were happy to see.  We are looking to make community contributed code easier in the future.

Hope that helps.

We're looking to upgrade from the 1.0 version of the toolkit to 11.0. However, it looks like our old code, which creates a SforcePartnerClient, and then uses setClientId after creating the connection.

This code seems to have gone away - there's no mention of setClientId in the code anymore. Instead of doing this, do we now just create an Enterprise client object and skip the setClientId step? Are there any other steps to upgrading or is everything pretty much backwards-compatible? (There just seems to be a lack of detail about an upgrade path)
Tran ManTran Man
Thanks for pointing it out, you identified a hole in the sample documentation. 

Although you can technically do it, it doesn't make sense to set a Client ID on an enterprise wsdl connection.  If you're developering a partner app, you should be using the partner wsdl.

Here is a code sample for CallOptions which supercedes the setClientId method in the old toolkit. Let me know if it works for you so that i can post it.  The first argument to CallOptions is a Client and hte second is a namespace prefix for managed packages.  Both are optional. 

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');

try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
  $callOptionsHeader = new CallOptions('YourClientId', 'aNamespace');
  $loginResult = $mySforceConnection->login($username, $password);
} catch (Exception $e) {
  echo $e->faultstring;


That seems like it works. I was able to connect and perform a call without any problems. Thank you!
This approach worked for me too, but how can I tell that the Client ID took?  I was able to make my Client ID and Namespace anything and I kept passing through.  Is the only way to tell by testing it using Professional Ediiton since that's what the Client ID is used for?

Also, what should be put for aNamespace?  Does this value get validated?
the namespace is only useful if you're developing managed packages, in which case you can specify the namespace of package, and this'll let you refer to fields using their unqualified name.

e.g. you have a managed package with a namespace of foo, and you have custom fields on account of foo_bar, foo_baz, and foo_quartz. If you set the namespace header to "foo", you can use bar,baz,quartz as the field names in your API calls (e.g. in a SOQL query, or an update call).
Thanks.  I downloaded the new help file for the API and it explains it in there.  Guess I should've done that before asking. :)
Where did you find that API doc? I downloaded the PHP toolkit and it has links to api docs that aren't there. I'm looking for any kind of documentation that explains the PHP API better. The methods all seem to work and all, but there are some times when I wish I could look up a document and read up on what a QueryOptions object is all about, ya' dig?
Park Walker (TAGL)Park Walker (TAGL)
Try http://wiki.apexdevnet.com/index.php/Web_Services_API#API