This is a discussion on $loginResult keeps returning false within the Salesforce Coding Discussions forums, part of the Salesforce category; Hello all! iam glad to have found this site, very clear tutorials
Hello all! iam glad to have found this site, very clear tutorials and answers... thnx Mike!
I have a little issue that i havent been able to fix:
I have this script that was fully working in a previous server but stopped when we moved the application to a lunar pages server .
The thing is that this server required a custom SOAP configration through the .htaccessfile and the php.ini file... according to the steps I have installed the SOAP module as its supposed to...
But when i run the script $loginResult allways comes false here is what i have:
try { //connect to salesforce session_start(); $client = new SforcePartnerClient(); $client->createConnection($wsdl); $loginResult = $client->login($username, $password);
if (!$loginResult) { exit("<strong>Login failed for user <code>$username</code>. The script is being terminated. <strong>"); }else{ $_SESSION['location'] = $client->getLocation(); $_SESSION['sessionId'] = $client->getSessionId(); $_SESSION['wsdl'] = $wsdl; $_SESSION['usr'] = $username; $_SESSION['pwd'] = $password;
Notice: Use of undefined constant SOAP_COMPRESSION_ACCEPT - assumed 'SOAP_COMPRESSION_ACCEPT' in /home/user/public_html/sfdc/includes/soapclient/SforceBaseClient.php83
Notice: Use of undefined constant SOAP_COMPRESSION_GZIP - assumed 'SOAP_COMPRESSION_GZIP' in /home/user/public_html/sfdc/includes/soapclient/SforceBaseClient.php84
Notice: Trying to get property of non-object in /home/user/public_html/sfdc/includes/soapclient/SforceBaseClient.php114
Notice: Trying to get property of non-object in /home/user/public_html/sfdc/includes/soapclient/SforceBaseClient.php124
Notice: Trying to get property of non-object in /home/user/public_html/sfdc/includes/soapclient/SforceBaseClient.php126 Login failed for user user@address.com. The script is being terminated.
This script used to work perfectly but im going nuts trying to find what is happening...
When you say that this script used to work perfectly, do you mean this exact same script that you posted here? If that is the case and it does not work any longer, did you make some changes to your PHP configuration? Upgrade? or did you change the code at all?
Do you have the original code?
I will try your code tomorrow and see if I can get it to work or trouble shoot it and post a correction.
Sorry for the delay in responding, I have been on vacation
First we had this very same code working in an other server, that had soap enabled and the php.ini file cofigured and the soap info in the phpinfo() was showing correctly and the code worked ok.
Then we moved the code to a new server that required to enable manually soap https://support.lunarpages.com/knowl...es/article/313 i followed the steps but i believe its not working since its not showing in the phphinfo().
Here is the code for the .htaccess file:
*********
AddHandler x-httpd-php5 .php
suPHP_ConfigPath /home/medical/public_html
*********
Here is the code for the php.ini file:
*********
include_path = .:/usr/local/lib/php:/home/medical/pear
*********
Also added to the SforceBaseClient.php:
******
PHP Code:
require_once ('SOAP/Client.php'); // added value.php because it started to show SOAP_header class not found, (dont know it this is correct though) require_once ('SOAP/Value.php');
The application now works so let me share a few comments regarding this 4 day nighmare.
After a lot of back and forth emailing with the host and after 3 days waiting for a reply to my ticket they finally enabled soap, even though they said that it was already enabled it wasnt.
Their solution to enable soap?
1. To add 2 folders to my root named /lib/php/ and copied the soap.so and a soap.la files
2. Modified the php.ini file adding:
extension_dir = /home/username/lib/php
extension = soap.so
Another note worth to mention regarding the hosting server:
In my root directory I have /public_html and also have /www.
I was using the /public_html to store my files inside (/public_html/sfdc/all application files here)
I noticed that when the host created a phpinfo() file they stored it inside the /www not the /public_html so even though they are supposed to have the same files (I think) I had one more file in the /www than in /public_html. SO I put all the application files inside /www/sfdc
Also to the SforceBasweClient.php i added:
PHP Code:
require_once ('SOAP/Client.php');
(this is the pear file)
So finally the application is working, I am using some ajax so I am currently modifying that.
Now I can say: Feliz Aņo Nuevo!! (Happy New Year!!)
Mike thnx for your help!
Greetings from MX!!
Lacho
Last edited by lachof; 01-03-2008 at 12:52 PM.
Reason: Data update
Bookmarks