PHP SOAP Quickstart Guide
Examples of how to use ListManager's functions with PHP are available in your ListManager's soap directory:
http://yourlistmanagerurl/soap
Your ListManager installation inlcudes a toolkit for php, NuSoap. To use it and run a simple test:
1. Unzip and install the NuSoap client on your webserver to a directory (e.g., to /var/www/html/lmapiTest). NuSoap may be found at http://yourlistmanagerserver/soap/php/nusoap-0.6.7.zip
2. Create a new php file called test.php in the lmapiTest directory.
Your directory structure should look like this in your webserver:
lmapiTest/
|
|_ test.php
|_ lib/
|_ samples/
3. To run your script, point your browser to the location:
http://[YOURWEBSERVER]/lmapiTest/lmapiTest.php
If you are using php as a standalone, run
php test.php
The following is the minimal client script for PHP:
-----PHP------
<?
$userName = 'admin';
$password = 'lyris';
// create client
$lmapiClient = new soapclient( $wsdl_location, true );
//set basic authentication
$lmapiClient->setCredentials($userName,$password, 'basic');
//make sure there was no error.
$err= $lmapiClient->getError();
if ($err) {
echo "<h2>Error</h2><pre> $err <hr> $lmapiClient->debug_str;\n\n";
return false;
}
$lmapi = $lmapiClient->getProxy();
//set basic authentication
$lmapi->setCredentials($userName,$password, 'basic');
if ( $lmapi->ApiVersion() != "1.0 Beta" )
{
echo "<h3>Incorrect API version! Expected: ".$lmapi->ApiVersion()."</h3>";
return false;
}
?>
![]() ![]() |