I am using the PHP Toolkit (v20) with the Enterprise WSDL to access my Salesforce objects and records in my webapp.
I successfully got everything working on my localhost.
When I uploaded the script to my webhost (inmotion), the create function simply does not work. It does not show any errors or warnings (although I have set error reporting to E_ALL), but execution of the script simply stops when it encounters the create function.
However, running a query using the query function or something like getting the server timestamp works fine.
Again, it works fine on my localhost, so I dont think its a code problem, but for the life of me I cannot figure out the problem, as no errors/warnings are displayed nor exceptions thrown.
I should clarify that although in this example I am trying to insert into my custom object, I have tried to insert into a standard Account or Contact object as well and it has not made any difference.
It will be great if somebody can guide me on how I can go about trying to troubleshoot the problem.
Thanks.
Code is as follows:
<html>
<head></head>
<body>
<?php
ini_set("soap.wsdl_cache_enabled", "0");
define("USERNAME", "myusername");
define("PASSWORD", "mypassword");
define("SECURITY_TOKEN", "mysecuritytoken");
require_once ('soapclient/SforceEnterpriseClient.php');
try {
$sflink = new SforceEnterpriseClient();
$sflink->createConnection("soapclient/auv.wsdl.xml",null,array('trace'=>true));
//$sflink->createConnection("soapclient/auv.wsdl.xml");
$sflink->login(USERNAME, PASSWORD.SECURITY_TOKEN);
// Test to get the server timestamp - Works fine.
echo "Getting Timestamp<br>";
$resp = $sflink->getServerTimestamp();
print_r($resp);
echo "<br>";
// Test to query the server - Works fine.
$query = "SELECT Id, AccountId, FirstName, LastName FROM Contact WHERE Email = '[email protected]'";
$response = $sflink->query($query);
echo "Select result is: <br>";
print_r($response);
echo "<br>";
// Insert into UVSI Search Object (My custom object) - Does not work
$sObject = new stdclass();
$sObject->Account__c = "00190000006yxUrAAI";
$sObject->Contact__c = "00390000005ZYLcAAO";
$sObject->Application__c = "AAP";
$sObject->Flow__c = 66;
$sObject->Flow_Unit__c = "m3-hr";
$sObject->Dose__c = 33;
$sObject->UVT__c = 99;
echo "Attempting creation<br>";
$createResponse = $sflink->create(array($sObject), 'UVSI_Search__c');
echo "This line never prints.<br/>";
} catch (Exception $e) {
echo "In error condition<br>";
echo $sflink->getLastRequest();
echo $e->faultstring;
exit();
}
?>
</body>
</html>
error_reporting(E_ALL);ANDini_set('display_errors', true);and all other ini_set things? -> bit.ly/15C3oVX - Daniel W.