• sgenin
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
Hello,
I try to insert objects using the PHP API.
All the SELECT commands work, the CREATE commands return no error, but nothing is created.
Here is my code :

$client = new SalesforceClient($result->sessionId);
$client->_endpoint = $result->serverUrl;
$client->setOpt("timeout", 60);

$query_str = "select Id,description from lead where email='$email' and isConverted=False";

$result = $client->query($query_str);

if (PEAR::isError($result))
{
print "

".$result->getMessage()."
";
print "$query_str

";
$ret=0;
}
else
{
// No lead in the database
if (count($result->records) == 0)
{
$FIELDS=array(
'type' => 'lead',
'FirstName' => utf8_encode($firstname),
'LastName' => utf8_encode($lastname),
'Title' => utf8_encode($title),
'Company' => utf8_encode(strtoupper($company)),
'Website' => utf8_encode($url),
'Email' => utf8_encode($email),
'Phone' => utf8_encode($phone),
'Street' => utf8_encode($street),
'PostalCode' => utf8_encode($zip),
'City' => utf8_encode($city),
'Country' => utf8_encode($country),
'LeadSource' => utf8_encode($know_us),
'Recevoir_les_Infos_modifi_le__c' => $info_date,
'Recevoir_les_Infos_par_email__c' => utf8_encode($info_str),
'Recevoir_la_Newsletter__c' => utf8_encode($news_str),
'Recevoir_la_Newsletter_modifie_le__c' => $nl_date,
'Origine_du_contact__c' => utf8_encode($source));
$result=$client->create($FIELDS);

if (PEAR::isError($result))
{
print ("

".$result->getMessage()."
");
print_r ("$FIELDS

");
$ret=0;
}
}
}


At the end, I have no error, but nothing is inserted...
Can someone help me please?

Thanks
Stéphane
  • October 18, 2005
  • Like
  • 0
Hello,

I want to create a lead from my web site using the PHP/SOAP API.

my code is the following :

$client = new SalesforceClient();
$result = $client->login($name,$pass);

if (PEAR::isError($result))
{
$errors = "Error: " . $result->getMessage() . "\n";
echo "

$errors

";
$ret=0;
}
else
{
$client = new SalesforceClient($result->sessionId);
$client->_endpoint = $result->serverUrl;

$query_str = "select Id,description from lead where email='$email' and isConverted=False";

$result = $client->query($query_str);

if (PEAR::isError($result))
{
print "

".$result->getMessage()."
";
print "$query_str

";
$ret=0;
}
else
{
if (count($result->records) == 0)
{
$FIELDS=array(
'type' => 'lead',
'FirstName' => utf8_encode($firstname),
'LastName' => utf8_encode($lastname),
'Title' => utf8_encode($title),
'Company' => utf8_encode(strtoupper($company)),
'Website' => utf8_encode($url),
'Email' => utf8_encode($email),
'Phone' => utf8_encode($phone),
'Street' => utf8_encode($street),
'PostalCode' => utf8_encode($zip),
'City' => utf8_encode($city),
'Country' => utf8_encode($country),
'LeadSource' => utf8_encode($know_us),
'Recevoir_les_Infos_modifi_le__c' => $info_date,
'Recevoir_les_Infos_par_email__c' => utf8_encode($info_str),
'Recevoir_la_Newsletter__c' => utf8_encode($news_str),
'Recevoir_la_Newsletter_modifie_le__c' => $nl_date,
'Origine_du_contact__c' => utf8_encode($source));

$result=$client->create($FIELDS);
}
}
The login is OK.
The select is OK too.

However, I sometimes receive a "curl error 500" on the create, that doesn't occurs every time. I just tried 10 times to add a lead this way, and I received an error. Then, I created a lead using the username/password provided in the login, and after that I retried. My first try was unsuccessful again, then it worked... Once it worked, it seems to be OK during a "certain period of time..." (I had the same behaviour yesterday evening (KO, KO, KO... then OK,OK,OK, but it failed again this morning.


Does someone know where could be the problem?

Thanks
Stéphane
  • February 24, 2005
  • Like
  • 0
Hello,
I try to create a lead using the API. Here is my code :

$FIELDS=array(
'type' => 'lead',
'FirstName' => $firstname,
'LastName' => $lastname,
'Title' => $title,
'Company' => $company,
'Website' => $url,
'Email' => $email,
'Phone' => $phone,
'Street' => $street,
'PostalCode' => $zip,
'City' => $city,
'Country' => $country,
'LeadSource' => $know_us,
'Recevoir_les_Infos_modifie_le__c',$info_date,
'Recevoir_les_Infos_par_email__c',$info_str,
'Recevoir_la_Newsletter__c',$news_str,
'Recevoir_la_Newsletter_modifie_le__c',$nl_date,
'Origine_du_contact__c',$source,
'Description',$description);

$result=$client->create($FIELDS);

As soon as I have accentuated characters in some fields (FirstName, LastName, ...), I get the following error :

soap_fault Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => soapenv:Server.userException [message] => java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8 sequence. [userinfo] => [backtrace] => [callback] => )

java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8 sequence.

Do you know what I shall do to have it working?

Thanks
Stéphane
  • January 14, 2005
  • Like
  • 0
Hello,
I try to insert objects using the PHP API.
All the SELECT commands work, the CREATE commands return no error, but nothing is created.
Here is my code :

$client = new SalesforceClient($result->sessionId);
$client->_endpoint = $result->serverUrl;
$client->setOpt("timeout", 60);

$query_str = "select Id,description from lead where email='$email' and isConverted=False";

$result = $client->query($query_str);

if (PEAR::isError($result))
{
print "

".$result->getMessage()."
";
print "$query_str

";
$ret=0;
}
else
{
// No lead in the database
if (count($result->records) == 0)
{
$FIELDS=array(
'type' => 'lead',
'FirstName' => utf8_encode($firstname),
'LastName' => utf8_encode($lastname),
'Title' => utf8_encode($title),
'Company' => utf8_encode(strtoupper($company)),
'Website' => utf8_encode($url),
'Email' => utf8_encode($email),
'Phone' => utf8_encode($phone),
'Street' => utf8_encode($street),
'PostalCode' => utf8_encode($zip),
'City' => utf8_encode($city),
'Country' => utf8_encode($country),
'LeadSource' => utf8_encode($know_us),
'Recevoir_les_Infos_modifi_le__c' => $info_date,
'Recevoir_les_Infos_par_email__c' => utf8_encode($info_str),
'Recevoir_la_Newsletter__c' => utf8_encode($news_str),
'Recevoir_la_Newsletter_modifie_le__c' => $nl_date,
'Origine_du_contact__c' => utf8_encode($source));
$result=$client->create($FIELDS);

if (PEAR::isError($result))
{
print ("

".$result->getMessage()."
");
print_r ("$FIELDS

");
$ret=0;
}
}
}


At the end, I have no error, but nothing is inserted...
Can someone help me please?

Thanks
Stéphane
  • October 18, 2005
  • Like
  • 0

Hi,

I am receiving this message everytime I attempt to run a simple select query on the Account table. The query does return some rows sometimes but the majority of the times it returns the error.

curl_exec error 28 Operation timed out with 0 out of -1 bytes received
select Id,Name from account

I am using the PHP Sample and have simply changed the table name (and fields) from lead to account.

Does anyone have any ideas what the problem could be?

Any help would be greatly appreciated!

Curious if there is a way to in effect "click" the Enable Self-Service button that is in SalesForce on the contact detail screen?  And still having SalesForce send out the contact's email with their username and password.

For various reasons I am looking for a way to automatically set users up for access to the SSP, avoiding a human having to find a customers contact record and clicking the button to setup the users.  Picture a batch process that looks for accounts that have a certain Asset record and if so automatically set each contact on that account up with access to the SSP.  We also have a large amount of contacts from our old CRM to import into SalesForce.  This set of contacts also needs to be setup with SSP access, it would be nice to not have to have a human touch a few thousand records to accomplish this.

hey,
we are getting regular timeouts on the PHP Curl libraries. I've extended the timeout from 4s to 10s but there are still problems. This mostly occurrs at close-of-business. Any solutions beyond further extending the timeout that would stop this from crippling our web portal? The site is hosted in Cedir Falls, IA, I really don't think there could be need for more than 10s round trip from IA to SFDC servers.

Adrian Fitzpatrick
Verve Software