Hey Mike,
I'm trying to view all the spam in our salesforce account. Here's what I got:
PHP Code:
include "loginInfo.php";
require_once ('./includes/soapclient/SforcePartnerClient.php');
require_once ('./includes/soapclient/SforceHeaderOptions.php');
require_once ('./includes/soapclient/SforceBaseClient.php');
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
$mylogin = $mySforceConnection->login($username, $password);
$query = "Select LastName, Id, Email, FirstName From Lead WHERE
Email LIKE '%tivan%' OR
Email LIKE '%ialis%' OR
Email LIKE '%evitra%' OR
Email LIKE '%ropecia%' OR
Email LIKE '%ramadol%' OR
Email LIKE '%alium%' OR
Email LIKE '%iagra%' OR
Email LIKE '%anax%'
Order by Email";
$queryResult = $mySforceConnection->query($query);
$records = $queryResult->records;
if(sizeof($records) > 0)
{
echo "<center><table border=1>\n<tr><th>ID</th><th>Email</th><th>Firstname</th><th>Lastname</th></tr>\n";
foreach ($records as $record)
{
$sObject = new SObject($record);
$id = $sObject->Id;
$first = $sObject->fields->FirstName;
$last = $sObject->fields->LastName;
$email = $sObject->fields->Email;
if(strlen($first) == 0)
$first = "[not provided]";
if(strlen($last) == 0)
$last = "[not provided]";
echo "<tr><td>$id</td><td>$email</td><td>$first</td><td>$last</td></tr>\n";
}
echo "</table></center>";
}
For some reason, I'm only pulling the Id and not the FirstName, LastName and Email. Any ideas on what I'm doing wrong?
Bookmarks