New syntax in PHP Tools 1.3 Connections

Since we simplified the connection handling in PHP Tools 1.3 and store all connections in the settings file we have also changed the connection syntax for PHP Tools.

The connection settings are now stored in the WcfSettingsObject object set up in settings.php. We removed the compression, connString and sharedKey parameters from the argument array and moved this into the WcfSettingsObject.

// Excerpt from settings.php
$WcfSettingsList = new WcfSettingsList();
$WcfSettingsList->append(new WcfSettingsObject("SharePointConnection1", "", "MySharedKey", "sharepoint_connection", 0));
$WcfSettingsList->append(new WcfSettingsObject("SharePointConnection2", "", "MySharedKey", "sharepoint_customerssite", 0));
$WcfSettingsList->append(new WcfSettingsObject("SharePointConnection3", "", "MySharedKey", "sharepoint_testsite", 0));


Selecting with SELECT

$SharePointQuery = new SharePointQuery(array(
    'sql' => "SELECT * FROM Tasks WHERE ID > 10",
    'connection_name' => 'SharePointConnection1'

Selecting by list and view name

$SharePointQuery = new SharePointQuery(
        'listName' => 'Tasks',
        'viewName' => 'All Tasks',
        'includeAttachements' => false,
        'connection_name' => 'SharePointConnection1',
        'columns' => ''


$SharePointNonQuery = new SharePointNonQuery(array(
    'sql' => "INSERT INTO Tasks (Title,AssignedTo,Status,Priority,DueDate,PercentComplete) VALUES ('Test task from PHP',1,'In Progress','(1) High', '".  date('Y-m-d H:i:s') ."',0.95)",
    'method' => 'ExecuteNonQuery',
    'connection_name' => 'SharePointConnection1'


$SharePointNonQuery = new SharePointNonQuery(array(
    'sql' => "UPDATE Tasks SET Title = 'Test task from PHP (updated)' WHERE PercentComplete = 0.95 AND TITLE = 'Test task from PHP'",
    'method' => 'ExecuteNonQuery',
    'connection_name' => 'SharePointConnection1'


$SharePointNonQuery = new SharePointNonQuery(array(
    'sql' => "DELETE FROM Tasks WHERE Title = 'Test task from PHP (updated)' OR Title = 'Test task from PHP'",
    'method' => 'ExecuteNonQuery',
    'connection_name' => 'SharePointConnection1'

Using with stored procedures

There is a complete list with available procedures at the documentation site,

Downloading a file

$download = new CamelotDownloadFile(array(
    "file" => $_GET["file"],
    "listName" => 'Shared Documents',
    "connection_name" => 'SharePointConnection1'


Uploading a file

$args = array(  "file" => $_FILES,
    "listName" => 'Shared Documents',
    "folder" => 'Folder/',
    "connection_name" => 'SharePointConnection2'

$UploadFile = new CamelotUploadFile($args);

PHP Tools official documentation:

Contact us if you have any questions regarding the PHP Tools.

This entry was posted in PHP. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>