NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Handling regular functions and NuSOAP


Joined: 23 Aug 2010
Posts: 1
Location: Boston, MA
Reply with quote
I'm using NuSOAP with Salesforce's API service. I have a script and would like to deal with some pieces as functions, but whenever I do that I get fatal errors like:

Fatal error: Call to a member function create() on a non-object

If I simply just paste my code within my script, it works great! However if I work it as a function, it is as if NuSOAP can't find what it needs to... ummm, function. Do I need to pass something in particular to the function to make it work?

Thanks! Example below.

-Chuck


eg:

// my main run.php script:

require_once('functions.php');

require_once('salesforce.php'); // this file has the include for the nusoap.php library

$username = 'sfapi@mydomain.com';
$password = '*******';

task_update($sfid,$thecampaignid);




// task update function from functions.php below.

function task_update($sfid,$campaignid) {

// update the task list with this item
$thedate = date('m/d/Y');

$thedate = gmdate("Y-m-d H:i:s", time());
$task = new sObject('Task',
null,
array(
'WhoID' => $sfid,
'Description' => 'Another activity detail on ' . $thedate,
'Status' => 'Completed',

'Subject' => ' Activity logged: ' . $campaignid

)
);
$createResult = $sfdc->create($task);

}

// end of function
View user's profileFind all posts by cewyattjrSend private message
Handling regular functions and NuSOAP
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic