2013-03-06 73 views
2

我已經使用Salesforce提供的PHP工具箱中的phpTookit連接salesforce,但是今天我得到了使用phptoolkit連接到salesforece沙箱的需求,有沒有什麼辦法可以連接。salesforce沙箱連接使用php

回答

2

呼叫對setEndpoint調用的createConnection後,和端點設置爲https://test.salesforce.com端點:

define("USERNAME", "[email protected]"); 
define("PASSWORD", "yourpassword"); 
define("SECURITY_TOKEN", "securitytoken"); 

require_once ('soapclient/SforceEnterpriseClient.php'); 

$mySforceConnection = new SforceEnterpriseClient(); 
$mySforceConnection->createConnection("soapclient/enterprise.wsdl.xml"); 
// this sets the endpoint for a sandbox login: 
$mySforceConnection->setEndpoint('https://test.salesforce.com/services/Soap/c/32.0'); 
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN); 

以上代碼來自Force.com Toolkit for PHP示例,setEndpoint行是爲連接到沙箱而添加的行。