Contents

Login

Sample Call

<?php
// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.ocm password

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');

try {
  $mySforceConnection = new SforceEnterpriseClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

  echo "***** Login Info*****\n";
  print_r($mylogin);
} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
}
?>

Sample Output

***** Login Info*****
stdClass Object
(
    [metadataServerUrl] => https://na3-api.salesforce.com/services/Soap/m/11.1/4
70500D300000005wk1
    [passwordExpired] =>
    [serverUrl] => https://na3-api.salesforce.com/services/Soap/c/11.1/470500D30
0000005wk1
    [sessionId] => 470500E400000005ak1!W7YAZPw_dpBNhjVgC.bWbFdLFOqvu6O81ifY417N2
4qQdsrQp0qRMFXwbAkhE1KykqGCwuXikBOIzVh_Y6APdKYgNbpqm5xua_awIKDyBH0Gh8hAeY2bjJflP
v2TuN5r5y9NvQCW
    [userId] => 00320000000aH2tBAE
    [userInfo] => stdClass Object
        (
            [accessibilityMode] =>
            [currencySymbol] => $
            [orgDefaultCurrencyIsoCode] => USD
            [organizationId] => 00E400000004wj1FBA
            [organizationMultiCurrency] =>
            [organizationName] => Salesforce
            [profileId] => 00e30000000luYqAAI
            [roleId] =>
            [userDefaultCurrencyIsoCode] =>
            [userEmail] => test@test.com
            [userFullName] => Nick Tran
            [userId] => 00320000000aH2tBAE
            [userLanguage] => en_US
            [userLocale] => en_US
            [userName] => test@test.com
            [userTimeZone] => America/Los_Angeles
            [userType] => Standard
            [userUiSkin] => Theme2
        )

)

LoginScopeHeader

Sample Call

<?php
// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.ocm password

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once ('../../misc/globalconstants.php');

try {
  $mySforceConnection = new SforceEnterpriseClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
  $header = new LoginScopeHeader('00E400000003wa1FBB');
  $mySforceConnection->setLoginScopeHeader($header);
  $mylogin = $mySforceConnection->login("test@testuser.com", "dfasdfdsaf");

  print_r($mylogin);
  print_r($mySforceConnection->getServerTimestamp());

} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
}
?>

Sample Output

stdClass Object
(
    [metadataServerUrl] => https://na3-api.salesforce.com/services/Soap/m/11.1/4
70700D300000002wda
    [passwordExpired] =>
    [serverUrl] => https://na3-api.salesforce.com/services/Soap/c/11.1/470700D30
0000004wk2
    [sessionId] => 470700D300000004wa1!NihTLIo0q_e7tgrt6ITc4tonOe7dqklq4PYhd.qAs
6O4l7rCsvK3YNcH1KIGqzS5BqmA_zYG5Jd2hF_LiL4pcjATBUNS7kv68fLwTEOKZEe8frKqnHWqna8tH
zLQk0b.r3KLFACW
    [userId] => 03450000000hXLcAAF
)
stdClass Object
(
    [timestamp] => 2008-01-30T01:36:11.710Z
)