You need to sign in to do that
Don't have an account?
How to open the SF files from a PHP site
I built a PHP site, and display the information to my customers. The data source is pick up from my Salesforce server. But we didn't buy SF customer portal license. We just connect SF from PHP using SOAP.
It could connect SF and get all data successfully. But we could not open the files saved in Salesforce.
the following is our PHP code.
testsf.php
<?php
define('TEST_MODE',1);
try{
define("SOAP_CLIENT_BASEDIR", "soapclient"); //my
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
// connect to sales force
$wsdl = (SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection($wsdl);
$USERNAME='*****';
$PASSWORD='****';
echo "test start <br>";
// login to sf
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
$_SESSION['sessionId'] = $mySforceConnection->getSessionId();
echo "sessionId".$_SESSION['sessionId']." <br>";
$query = "SELECT Id,Name from Account ";
$response = $mySforceConnection->query(($query));
// load OffsetProjects into arrays
foreach ($response->records as $item) {
$id[$item->Id]=$item->Id;
$name[$item->Id]=$item->fields->Name;
}
} catch (Exception $e) {echo $e;}
?>
<div style="float:left; width:650px; margin-right:10px;">
<a href="https://MySFdomain/servlet/servlet.FileDownload?file=******&sessionId=<?php echo $_SESSION['sessionId'] ?>">
https://MySFdomain/servlet/servlet.FileDownload?file=******&sessionId=<?php echo $_SESSION['sessionId']?>
</a>
</div>
<!----end-->
I tried ?sid and ?csssid too, click the link just bounce me to the Salesforce login page. my customers have no username to login salesforce.
Would you please help me to resovle the problem. Any good idea?