//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 = "[email protected]";
//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中創建銷售線索。這是salesforce的一個php工具包示例代碼。Salesforce與magento的集成
但是當我試圖運行此代碼。它在salesforce中沒有產生任何領先優勢。 我的登錄憑證是正確的,安全令牌也是正確的。
我哪裏錯了?我正在使用免費開發者帳戶和以下代碼在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>
$結果會告訴你爲什麼它沒有被創建。 – superfell