我试图通过构建一个简单的应用程序来增加我对 PHP 的了解,该应用程序利用通过 Salesforce API 获得的数据。这是我到目前为止所得到的,主要是通过复制/粘贴和查看示例代码:
<?php
define("USERNAME", "");
define("PASSWORD", "");
define("SECURITY_TOKEN", "");
require_once ('[file-path]/SforceEnterpriseClient.php');
$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection->createConnection("[file-path]/wsdl.jsp.xml");
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
$query = "SELECT Id, FirstName, LastName, Phone from Contact";
$response = $mySforceConnection->query($query);
echo "Results of query '$query'<br/><br/>\n";
foreach ($response->records as $record) {
// Id is on the $record, but other fields are accessed via the fields object
echo $record->Id . ": " . $record->fields->FirstName . " "
. $record->fields->LastName . " " . $record->fields->Phone . "<br/>\n";
}
?>
问题是,当我尝试运行此脚本(http://moneythink.org/sf-app.php)时,服务器只返回一条错误消息;不知道为什么会这样。
非常感谢任何和所有的帮助!