//Create a new partner object
$connection = new SforcePartnerClient();
//Create the SOAP connection
try {
$connection->createConnection(salesforce_wsdl);
} catch (Exception $e) {
//Salesforce could be down, or you have an error in configuration
//Check your WSDL path
echo "Salesforce could be down";
}
//Pass login details to Salesforce
try {
$connection->login(salesforce_username, salesforce_password . salesforce_token);
} catch (Exception $e) {
//Make sure your username and password is correct
echo "usename/password incorrect";
}
//Describing the Leads object and printing the array
$describe = $connection->describeSObjects(array('Lead'));
print_r($describe);
//Create New Lead
$leadFirstName = "John";
$leadLastName = "Doe";
$leadCompany = "abc";
$leadEmail = "chetan@abc.com";
//Creating the Lead Object
$lead = new sObject();
$lead->type = 'Lead';
$lead->fields = array(
'FirstName' => $leadFirstName,
'LastName' => $leadLastName,
'Company' => $leadCompany,
'Email' => $leadEmail
);
//Submitting the Lead to Salesforce
$result = $connection->create(array($lead), 'Lead');
这是我的代码...我只是想使用此代码在销售人员中创建潜在客户。这是salesforce 的示例php 工具包代码。
但是当我试图运行这段代码时。它不会在销售人员中产生任何领先优势。我的登录凭据是正确的,安全令牌也是正确的。
我哪里错了?我在 partner.wsdl.xml 中使用免费的开发人员帐户和以下代码进行连接:
<!-- Soap Service Endpoint -->
<service name="SforceService">
<documentation>Sforce SOAP API</documentation>
<port binding="tns:SoapBinding" name="Soap">
<soap:address location="https://login.salesforce.com/services/Soap/c/26.0"/>
</port>
</service>