I had the 'pleasure' the other day of integrating Drupal with Salesforce.com using PHP. I didn't want to write all of my SOQL queries and business logic in my PHP scripts so I whipped up a quick Apex class and exposed it as a web service. I found a great blog post by Scott Hemmeter that really helped me out calling the service with PHP so I thought I would share the code and other observations.
First you will need to download the PHP Toolkit. The toolkit contains all of the PHP code necessary to make web service calls against your org. Please note that the contained Partner and Enterprise WSDLs are for Production/Developer orgs, so if you are running against a Sandbox, you will need to download the appropriate WSDL from that Sandbox.
For this example, I took my Person wrapper class and exposed it as a web serivce. It exposes a method that allows you to search for Contacts and Leads by email address and returns a List of generic Person objects.
Log into Salesforce.com and donwload the WSDL file for the PersonService class (Setup -> Develop -> Apex Classes). Also, make sure the profile calling the Web servcie has access to this class.
The PHP page looks like the following:
The PHP page should look something like the following: