how to connect with salesforce using php?

I am trying to connect with Salesforce using below lib and getting below issue and unable to find how to enable the API as per Error.

https://github.com/developerforce/Force.com-Toolkit-for-PHP

Code:-

<?php 
error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once ('soapclient/SforcePartnerClient.php');
$mySforceConnection = new SforcePartnerClient();



$mySoapClient = $mySforceConnection->createConnection("soapclient/partner.wsdl.xml");

$mylogin = $mySforceConnection->login("[email protected]", "pass#xa9Ur9xMD6qqdRhdmLBuiRev");
var_dump($mylogin);die;

 ?>


Fatal error: Uncaught SoapFault exception: [sf:API_DISABLED_FOR_ORG] API_DISABLED_FOR_ORG: 
API is not enabled for this Organization or Partner in 
/var/www/mssdev/force/soapclient/SforceBaseClient.php:168 Stack trace: 
#0 /var/www/mssdev/force/soapclient/SforceBaseClient.php(168): SoapClient->__call('login', Array) 
#1 /var/www/mssdev/force/soapclient/SforceBaseClient.php(168): SforceSoapClient->login(Array) 
#2 /var/www/mssdev/force/index.php(11): SforceBaseClient->login('xyz@gm...', 'fas#xa9Ur9...')
#3 {main} thrown in /var/www/mssdev/force/soapclient/SforceBaseClient.php on line 168

Upvotes: 0

Views: 593

Answers (2)

Use the developer account and the issue has solved.

Upvotes: 0

four4444
four4444

Reputation: 21

You are probably using Salesforce Gorup or Professional edition where the API is not available.

Other scenario (if You have other edition tham mentioned above) that the API is not enabled for Your user. However from the error message the most possible is scenario #1.

Upvotes: 1

Related Questions