• EMT
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 7
    Replies

Hello,

            I try to insert account name into my contact ,it is not creating the contact.How to do that?

$fields = array('type'=>'contact','LastName'=>'Inbam', 'Account_Name' =>'Mall Tech');

 

  • February 21, 2004
  • Like
  • 0

Hi,

      I having proble while adding date.

$fields = array('type'=>'contact','LastName'=>"$lname",'Birthdate' =>'12-03-1980');

$fields = array('type'=>'contact','LastName'=>"$lname",'Birthdate' =>'12/03/1980');

It is not creating the contact.

  • February 12, 2004
  • Like
  • 0

Hi,

         I am using the developer edition.I formed a new layout for my custom fields.While try to insert (using ur toolkit) a contact with custom field included is not working.But without custom field it is working fine.Is there any limitation for developer edition?.

 

The following code  is working

$fields = array('type'=>'contact','LastName'=>"$lname",'Title'=>'Formula 1','Phone' => '44334556','Email' => 'alenso@rediff.com', 'MailingStreet' => 'Austrias', 'MailingPostalCode' => '43434334');

The following code  is not working.It is not even creating a contact.Here OrderId is custom field.

$fields = array('type'=>'contact','LastName'=>"$lname",'Title'=>'Formula 1','Phone' => '44334556','Email' => 'alenso@rediff.com', 'MailingStreet' => 'Austrias', 'MailingPostalCode' => '43434334','OrderId' => '3');

 

 

  • February 11, 2004
  • Like
  • 0

Hi Adam,

Development Environment : Windows XP Professional, PHP 4.3.4, IIS 5.1

In the file "WebService_SforceService_Soap.php" I changed the URL from https: to http://www.salesforce.com/services/Soap/u/2.5. Then in the file "list.php", I hardcoded $client->_endpoint = "http://na1-api.salesforce.com/services/Soap/u/2.5". At this point I was able to see a workable version.

So I tried to optimise the code for automatic login and the below code is working if I try to insert a contact but I'm not able to insert a CUSTOM FIELD. I created a custom field OrderId in Contact.

<?php
 
 require_once("SalesforceClient.php");
 $client = new SalesforceClient();
 $result = $client->login('adm_emt@yahoo.com','emt123');
 
 $lname='Angelina';

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

  $sessid = $result->sessionId;

  $client = new SalesforceClient($sessid);
  $client->_endpoint = "http://na1-api.salesforce.com/services/Soap/u/2.5";
  
  $fields = array('type'=>'contact','LastName'=>"$lname",'Title'=>'Hollywood','Phone' => '1234556','Email' => 'michael@rediff.com');

  $client->create($fields); 

 }

?>

but if in $fields I assign

$fields = array('type'=>'contact','LastName'=>"$lname",'OrderId'=>'1');

its not working. I also prefixed OrderId with cf_OrderId, then also its not working. I was also not thrown any error.

 

  • February 10, 2004
  • Like
  • 0

Hi Adam,

Development Environment : (Windows XP Professional , PHP, IIS 5.1) and also tested on (Windows 2000 Server, PHP, IIS 5.0)

As said by you I downloaded the latest PHP toolkit and installed SOAP (with the command pear install SOAP-beta).

Executed login.php and input the user id, password.

In the file "WebService_SforceService_Soap.php" I changed the url from https: to http://www.salesforce.com/services/Soap/u/2.5. It is working but when https: is used then I got the foll. error :

Error: curl_exec error 60 SSL certificate problem, verify that the CA cert is OK

I also tried to insert a lead by using the below code (with the url http://www.salesforce.com/services/Soap/u/2.5) but it is not getting reflected :

$client = new SalesforceClient($SESSION);
$client->_endpoint = "https://na1-api.salesforce.com/services/Soap/u/2.5";

$FIELDS = array('type'=>'lead','FirstName'=>'newtest','LastName'=>'test','Company'=>'testthis');
$client->create($FIELDS);

 

We are in urgent need for this solution. Eagerly waiting for a reply at the earliest.

Thanks in advance for any valuable help/assistance.

 

  • February 09, 2004
  • Like
  • 0

Dear Sir,

                     My request php script is below.

<?
$user = 'adm_emt@yahoo.com';
$pwd = 'emt123';
$methodName = 'sfdc.login';
$url = 'www.salesforce.com';
$uri = '/servlet/servlet.Api?'.'methodName=' . $methodName .'&version=2.0'.'&username=' . $user . '&password=' . $pwd. '&secure=1' ;
$fp = fsockopen ($url, 80);
fwrite ($fp, "POST $uri HTTP/1.0\r\nHost: $url\r\n\r\n");
while ($data = fread($fp, 4096))
{
  print "$data";
 }
?>


I am getting the response

 

HTTP/1.1 200 OK Date: Thu, 05 Feb 2004 12:08:31 GMT Server: Apache Set-Cookie: sfdcweb=61.247.252.181.251181075982911219; path=/; expires=Fri, 04-Feb-05 12:08:31 GMT Connection: close Content-Type: text/xml; charset=UTF-8 faultStringunknown method name nullfaultCode1113

 

pl. help me sort out this problem.

  • February 05, 2004
  • Like
  • 0

Dear Sir,

                   I am  facing this problem while try to login using the following code.

 

<?
$user = 'adm_emt@yahoo.com';
$pwd = 'emt123';
$methodName = 'sfdc.login';

$url = 'www.salesforce.com';
// $uri = '/servlet/servlet.Api?'.'Username=' . $user . '&Password=' . $pwd . '&Version=' . '2.0.0.0'. '&MethodName=' .$methodName ;
$uri = 'http://www.salesforce.com/servlet/servlet.Api?'.'methodname=' . $methodName .'&Version=2.0'.'&Username=' . $user . '&Password=' . $pwd. '&secure=1' ;

$fp = fsockopen ($url, 80);

if($fp)
{
// print "Successfull";
}

fwrite ($fp, "POST $uri HTTP/1.0\r\nHost: $url\r\n\r\n");
while ($data = fread($fp, 4096))
{
  print "$data";
 }

?>

 

 

The Response is

 

HTTP/1.1 200 OK Date: Thu, 05 Feb 2004 11:25:40 GMT Server: Apache Set-Cookie: sfdcweb=61.247.252.181.250911075980340171; path=/; expires=Fri, 04-Feb-05 11:25:40 GMT Connection: close Content-Type: text/xml; charset=UTF-8 faultStringunknown method name nullfaultCode1113

 

  • February 05, 2004
  • Like
  • 0

Hi,

Development Environment : Windows XP Professional, PHP, IIS

Salesforce developer edition is used for testing.

Downloaded the zip file salesforce-php-0.50.tar from http://www.majordojo.com/salesforce/ and copied to a local system. Tried to execute login.php but got the foll. error :

Warning main(SOAP/Client.php): failed to open stream: No such file or directory in E:\salesforce-php\WebService_SforceService_Soap.php on line 19

Fatal error main(): Failed opening required 'SOAP/Client.php' (include_path='.;c:\php4\pear') in E:\salesforce-php\WebService_SforceService_Soap.php on line 19

In the readme.txt a pre-requisite was mentioned that "PHP v4.3.4 or greater - it is advised that you have client and pear support enabled Pear module: SOAP". Unable to understand.

Thanks in advance for any valuable help/assistance.

 

  • February 05, 2004
  • Like
  • 0

To Whomsoever It May Concern,

Development Environment : Windows XP Professional, ASP, IIS

Salesforce API version        : 2.0

Edition                                    : Salesforce Developer Edition

I want to add a contact thru salesforce API. I'm using ASP as the platform for communicating to salesforce API. I'm able to login but not able to set the HTTP header cookie for sessionid.

The error I'm getting is :

Error Number       : 1112

Error Description : session ID missing or invalid

My Code is as follows :

dim  user,pwd
dim strXML
dim insertXML,insert_id,insertlength

 user = "adm_emt@yahoo.com"
 pwd = "emt123"

'LOGIN SCRIPT STARTS

 Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
 objXML.open "POST", "http://www.salesforce.com/servlet/servlet.Api", false
 objXML.setRequestHeader "Content-Type","text/xml"

' Define ther xml request into a string
 xml_request = "<?xml version='1.0' ?><methodCall>"
 xml_request = xml_request & "<methodName>sfdc.login</methodName>"
 xml_request = xml_request & "<params><param><value><struct>"
 xml_request = xml_request & "<member><name>version</name>"
 xml_request = xml_request & "<value><string>2.0</string></value></member>"
 xml_request = xml_request & "<member><name>username</name>"
 xml_request = xml_request & "<value><string>" & user & "</string></value></member>"
 xml_request = xml_request & "<member><name>password</name>"
 xml_request = xml_request & "<value><string>" & pwd & "</string></value></member>"
 xml_request = xml_request & "<member><name>secure</name>"
 xml_request = xml_request & "<value><boolean>1</boolean></value></member>"
 xml_request = xml_request & "</struct></value></param></params></methodCall>"

'set the xml content length
 length = LEN(xml_request)
 objXML.setRequestHeader "Content-length", length

 objXML.send(xml_request)

 strXML = objXml.responseText
 response.Write server.htmlencode(strXML)

'LOGIN SCRIPT ENDS

'INSERT SCRIPT STARTS
 int1 = Instr(1,strXML,"session_id")
 int2 = Instr(int1,strXML,"<value>")

 insert_id = Mid(strXML,int2)
 insert_id = trim(insert_id)
 response.write "The Session ID is <br><br>"& insert_id

 xml_insert = xml_insert & "<?xml version='1.0' ?>"
 xml_insert = xml_insert & "<methodCall>"
 xml_insert = xml_insert & "<methodName>sfdc.insert</methodName>"
 xml_insert = xml_insert & "<params><param><value><struct>"
 xml_insert = xml_insert & "<member>"
 xml_insert = xml_insert & "<name>version</name>"
 xml_insert = xml_insert & "<value><string>2.0</string></value>"
 xml_insert = xml_insert & "</member>"
 xml_insert = xml_insert & "<member>"
 xml_insert = xml_insert & "<name>type</name>"
 xml_insert = xml_insert & "<value><string>contact</string></value>"
 xml_insert = xml_insert & "</member>"
 xml_insert = xml_insert & "<member>"
 xml_insert = xml_insert & "<name>record</name>"
 xml_insert = xml_insert & "<value><struct>"
 xml_insert = xml_insert & "<member><name>firstName</name><value>Test</value></member>"
 xml_insert = xml_insert & "<member><name>lastName</name><value>Test Smith</value></member>"
 xml_insert = xml_insert & "<member><name>accountID</name>"
 xml_insert = xml_insert & "<value>20</value></member>"
 xml_insert = xml_insert & "<member><name>title</name><value>VP of Sales</value></member>"
 xml_insert = xml_insert & "<member><name>email</name>"
 xml_insert = xml_insert & "<value>adm_emt@yahoo.com</value></member>"
 xml_insert = xml_insert & "<member><name>description</name>"
 xml_insert = xml_insert & "<value>Jim is good</value></member>"
 xml_insert = xml_insert & "</struct></value>"
 xml_insert = xml_insert & "</member>"
 xml_insert = xml_insert & "</struct></value></param></params>"
 xml_insert = xml_insert & "</methodCall>"

 Set insertOBJ = Server.CreateObject("Microsoft.XMLHTTP")
 insertOBJ.open "POST", "https://na1-api.salesforce.com/servlet/servlet.Api", false
 insertOBJ.setRequestHeader "Cookie", "sid=" & insert_id
' insertOBJ.setRequestHeader "", "session_id =" & insert_id
 insertOBJ.setRequestHeader "Content-Type","text/xml"

 

'insertOBJ.setRequestHeader(session_id )
' insertOBJ.setRequestHeader  session_id

' xmlhttp.setRequestHeader "Cookie", "session_id=" & session_id

'set the xml content length
 insertlength = LEN(xml_insert)
 insertOBJ.setRequestHeader "Content-length", insertlength

 insertOBJ.send(xml_insert)

 insertXML= insertOBJ.responseText
 response.Write "<br><br>" & server.htmlencode(insertXML)

'INSERT SCRIPT ENDS

Thanks in Advance for any help / assistance.

 

  • February 05, 2004
  • Like
  • 0

 

To Whomsoever It May Concern,

                     I want to add a contact thru salesforce API. I'm using ASP as the platform for communicating to salesforce API. I'm able to login but not able to set the HTTP header cookie for sessionid.

The error I'm getting is :

faultStringsession ID required in cookie for non-login requestfaultCode1005

My Code is as follows :

dim user,pwd

dim strXML

user = adm_emt@yahoo.com

pwd = "emt123"

Set objXML = Server.CreateObject("Microsoft.XMLHTTP")

objXML.open "POST", "http://www.salesforce.com/servlet/servlet.Api", false

objXML.setRequestHeader "Content-Type","text/xml"

' Define ther xml request into a string
 xml_request = ""
 xml_request = xml_request & "sfdc.login"
 xml_request = xml_request & ""
 xml_request = xml_request & "version"
 xml_request = xml_request & "2.0"
 xml_request = xml_request & "username"
 xml_request = xml_request & "" & user & ""
 xml_request = xml_request & "password"
 xml_request = xml_request & "" & pwd & ""
 xml_request = xml_request & "secure"
 xml_request = xml_request & "1"
 xml_request = xml_request & ""

 'set the xml content length
 length = LEN(xml_request)
 objXML.setRequestHeader "Content-length", length

 objXML.send(xml_request)

 strXML = objXml.responseText
 response.Write server.htmlencode(strXML)
 
 int1 = Instr(1,strxml,"session_id")
 int2 = Instr(int1,strxml,"")

 sessid = Mid(strxml,int2)
 
 xml_request = ""
 xml_request = xml_request & ""
 xml_request = xml_request & ""
   xml_request = xml_request & "sfdc.insert"
 xml_request = xml_request & ""
 xml_request = xml_request & ""
 xml_request = xml_request & "version"
 xml_request = xml_request & "2.0"
 xml_request = xml_request & ""
 xml_request = xml_request & ""
 xml_request = xml_request & "type"
 xml_request = xml_request & "contact"
 xml_request = xml_request & ""
 
 'Setting Cookie
 xml_request = xml_request & ""
 xml_request = xml_request & "sid"
 xml_request = xml_request & "" & sessid & ""
 xml_request = xml_request & ""

 xml_request = xml_request & ""
 xml_request = xml_request & "record"
 xml_request = xml_request & ""
 xml_request = xml_request & "firstNameTest"
 xml_request = xml_request & "lastNameTest Smith"
 xml_request = xml_request & "accountID"
 xml_request = xml_request & "0010000000000O9"
 xml_request = xml_request & "titleVP of Sales"
 xml_request = xml_request & "email"
 xml_request = xml_request & "JimSmith@yahoo.com"
 xml_request = xml_request & "businessPhone"
 xml_request = xml_request & "777-7777"
 xml_request = xml_request & "mailingAddress"
 xml_request = xml_request & "1 Main St."
 xml_request = xml_request & "mailingAddressCity"
 xml_request = xml_request & "Seattle"
 xml_request = xml_request & "mailingAddressState"
 xml_request = xml_request & "WA"
 xml_request = xml_request & "description"
 xml_request = xml_request & "Jim is good"
 xml_request = xml_request & ""
 xml_request = xml_request & ""
 xml_request = xml_request & ""
 xml_request = xml_request & ""

 response.write "

" & int1 & " " & int2 & " " & sessid
 
 'Setting Cookie
 objXML.open "POST", "https://na1-api.salesforce.com/servlet/servlet.Api?sid="&sessid, false
 objXML.setRequestHeader "Content-Type","text/xml"
 
 objXML.setRequestHeader "Cookie:"," sid=" & sessid & "=; Path=/"
 objXML.setRequestHeader "sid",sessid & "="
  
 'Cookie: sid=sessid=; Path=/
 
 'set the xml content length
 length = LEN(xml_request)
 objXML.setRequestHeader "Content-length", length

 objXML.send(xml_request)

 strXML = objXml.responseText
 response.Write "

" & server.htmlencode(strXML)
 

Eagerly waiting for help. Thanks in advance

 

 

  • February 04, 2004
  • Like
  • 0

Hello,

            I try to insert account name into my contact ,it is not creating the contact.How to do that?

$fields = array('type'=>'contact','LastName'=>'Inbam', 'Account_Name' =>'Mall Tech');

 

  • February 21, 2004
  • Like
  • 0

Hi,

         I am using the developer edition.I formed a new layout for my custom fields.While try to insert (using ur toolkit) a contact with custom field included is not working.But without custom field it is working fine.Is there any limitation for developer edition?.

 

The following code  is working

$fields = array('type'=>'contact','LastName'=>"$lname",'Title'=>'Formula 1','Phone' => '44334556','Email' => 'alenso@rediff.com', 'MailingStreet' => 'Austrias', 'MailingPostalCode' => '43434334');

The following code  is not working.It is not even creating a contact.Here OrderId is custom field.

$fields = array('type'=>'contact','LastName'=>"$lname",'Title'=>'Formula 1','Phone' => '44334556','Email' => 'alenso@rediff.com', 'MailingStreet' => 'Austrias', 'MailingPostalCode' => '43434334','OrderId' => '3');

 

 

  • February 11, 2004
  • Like
  • 0

Hi Adam,

Development Environment : (Windows XP Professional , PHP, IIS 5.1) and also tested on (Windows 2000 Server, PHP, IIS 5.0)

As said by you I downloaded the latest PHP toolkit and installed SOAP (with the command pear install SOAP-beta).

Executed login.php and input the user id, password.

In the file "WebService_SforceService_Soap.php" I changed the url from https: to http://www.salesforce.com/services/Soap/u/2.5. It is working but when https: is used then I got the foll. error :

Error: curl_exec error 60 SSL certificate problem, verify that the CA cert is OK

I also tried to insert a lead by using the below code (with the url http://www.salesforce.com/services/Soap/u/2.5) but it is not getting reflected :

$client = new SalesforceClient($SESSION);
$client->_endpoint = "https://na1-api.salesforce.com/services/Soap/u/2.5";

$FIELDS = array('type'=>'lead','FirstName'=>'newtest','LastName'=>'test','Company'=>'testthis');
$client->create($FIELDS);

 

We are in urgent need for this solution. Eagerly waiting for a reply at the earliest.

Thanks in advance for any valuable help/assistance.

 

  • February 09, 2004
  • Like
  • 0
An updated PHP toolkit has been posted at sforce.sf.net.

Changes include:

- Support for single logon server: This is required; the previous version of the toolkit was coded against a pre-release version of the 2.5 API, and will not work correctly without modification.

Files changed:

- WebService_SforceService_Soap.php
- login.php
- list.php

Note:

Currently, session id and soap endpoint URL are managed as client side cookies; this should probably be changed to use PHP sessions.

Let me know if there are any questions.

Adam
  • February 05, 2004
  • Like
  • 0

Dear Sir,

                     My request php script is below.

<?
$user = 'adm_emt@yahoo.com';
$pwd = 'emt123';
$methodName = 'sfdc.login';
$url = 'www.salesforce.com';
$uri = '/servlet/servlet.Api?'.'methodName=' . $methodName .'&version=2.0'.'&username=' . $user . '&password=' . $pwd. '&secure=1' ;
$fp = fsockopen ($url, 80);
fwrite ($fp, "POST $uri HTTP/1.0\r\nHost: $url\r\n\r\n");
while ($data = fread($fp, 4096))
{
  print "$data";
 }
?>


I am getting the response

 

HTTP/1.1 200 OK Date: Thu, 05 Feb 2004 12:08:31 GMT Server: Apache Set-Cookie: sfdcweb=61.247.252.181.251181075982911219; path=/; expires=Fri, 04-Feb-05 12:08:31 GMT Connection: close Content-Type: text/xml; charset=UTF-8 faultStringunknown method name nullfaultCode1113

 

pl. help me sort out this problem.

  • February 05, 2004
  • Like
  • 0