Today I had a small problem which took me a while to figure out, so thought I would post it in case anyone else has a similar problem.
Basically I had downloaded the PHP toolkit for use with salesforce and ran some examples with successes. However when I came to replace the WSDL files with my own sandbox ones I could no longer connect to salesforce.
I was using the correct username with the sandbox appended to the end of what would be my normal username, and the url in the enterprise.WSDL.xml file was set to https://test.salesforce.com/services/Soap/c/19.0/ as it should be, however it just would not connect, telling me it was an invalid login. The strange thing was the live username and password was still allowing me to login.
After sometime scratching my head I discovered that PHP was caching the WSDL file and therfore trying to connect to the live url and not the sandbox I had changed it to.
SO the solution I chose was to use:
in my script. I believe another option is to turn off in php.ini file:
1. Go to php.ini
2. Look for soap.wsdl_cache_ttl = “86400″. This is the default setting. 86400 is the number of seconds in a day. So when it is set to 86400, it would mean the cache is set for 1 day.
3. Change this value to zero. Once done, restart apache.
php.ini is the default path where this change is to be done. However this may be changed while php is being installed on the server. In that case, you would have to search for the file. If. even after all efforts, you have been unable to locate this file, then you may insert the default values for the soap section in the php.ini & then set
soap.wsdl_cache_ttl = “0″ soap.wsdl_cache_enabled = “1″ soap.wsdl_cache_dir = “/tmp” (this is the default directory where the cache files would go) soap.wsdl_cache_ttl = “86400″ (change this to 0 if you want wsdl cache to be disabled. Beware of “-1″. It means the value is set to unlimited.
Hope this helps to stop someone else being frustrated.