Sample

<?php
define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once ('../userAuth.php');

try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
  $callOptionsHeader = new CallOptions($YOURCLIENTID, $NAMESPACE);
  $mySforceConnection->setCallOptions($callOptionsHeader);
  $loginResult = $mySforceConnection->login($USERNAME, $PASSWORD);

  print_r($loginResult);
} catch (Exception $e) {
  echo $e->faultstring;
}
?>

Sample Output

stdClass Object
(
    [metadataServerUrl] => https://na3-api.salesforce.com/services/Soap/m/20.0/00D50000000IZ3Z
    [passwordExpired] => 
    [sandbox] => 
    [serverUrl] => https://na3-api.salesforce.com/services/Soap/u/20.0/00D50000000IZ3Z
    [sessionId] => 00D50000000IZ3Z!AQ0AQEL.4v8wqPSM2xFoRsdghuLc0qMGiSjQtZj1OaTCQ.Ko_.MPvhJz0ARRP4eaGd14m8v_Dlwgjug_g1IIT0zPsnZaVass
    [userId] => 00550000001fg5OAAQ
    [userInfo] => stdClass Object
        (
            [accessibilityMode] => 
            [currencySymbol] => $
            [orgDefaultCurrencyIsoCode] => USD
            [orgDisallowHtmlAttachments] => 
            [orgHasPersonAccounts] => 
            [organizationId] => 00D50000000IZ3ZEAW
            [organizationMultiCurrency] => 
            [organizationName] => Example
            [profileId] => 00e500000017TLdAAM
            [roleId] => 00E50000001CHosEAG
            [userDefaultCurrencyIsoCode] => 
            [userEmail] => user@example.com
            [userFullName] => Sample User
            [userId] => 00550000001fg5OAAQ
            [userLanguage] => en_US
            [userLocale] => en_US
            [userName] => user@example.com
            [userTimeZone] => America/Los_Angeles
            [userType] => Standard
            [userUiSkin] => Theme3
        )

)