2013-03-06 120 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行是为连接到沙箱而添加的行。