2
    //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>
4

3 回答 3

0

我很高兴你解决了它。只是要指出,用于描述线索和打印结果的区域不是必需的,例如就在那里。

于 2013-01-10T01:41:46.433 回答
0

我确实打印了结果的值,但效果不佳。当我使用合作伙伴 wsdl 时,我将 new SObject() 更改为 new stdClass() 并且它有效.. :)

于 2013-01-23T12:00:09.380 回答
-1

我知道一个很棒的 magento 扩展,它可以为你做这一切,甚至更多:https ://products.crunchyconsulting.com/crunchy-products/crunchy-magforce.html

查看帮助和文档选项卡,您甚至可以在其中找到演示截屏视频:

https://www.youtube.com/watch?v=TjxvjGcAGqY

https://www.youtube.com/watch?v=cmf4Ksv3uRM

于 2014-12-18T03:07:53.790 回答