The PHP SDK uses a HTTP form post with cURL and OpenSSL to allow customers to access the Esendex services. This provides reliable communications over both secure and non-secure connections.

The SDK can be downloaded from our Downloads section.

Setup

The following applications are required to use the Esendex PHP SDK:

  • PHP
  • OpenSSL (supplied as an extension module in the PHP download)
  • cURL (supplied as an extension module in the PHP download)
  1. Install PHP. You can either install manually or, for windows, use the windows installer (although the manually installation is recommended as no external extensions are included in the windows installer). Downloads and instructions for each method can be found from http://www.php.net/downloads.php
  2. Source download the latest version of OpenSSL from http://www.openssl.org/source/ - not required if using the supplied extension module in the PHP download.
  3. Source download the latest version of cURL from http://curl.haxx.se/dlwiz/ - not required if using the supplied extension module in the PHP download.

The PHP install will have the dll files in the extensions directory:

php_curl.dll
php_openSSL.dll

And the certificate file (for secure communications) is located in the Curl download:

Curl_ca_bundle.crt

These files will either need to be copied to a folder specified on the system path ( e.g. C:\Windows\ ), or the system path will have to be amended with the path to these files. We recommend that you add the php install directory to the system path as this makes it easier for you to update your PHP install when the new release is made available. For PHP to be configured to use OpenSSL and cURL on Windows we must uncomment the appropriate lines in the file ‘PHP.ini’ file being used to enable the Windows extensions.

;extension=php_curl.dll becomes extension=php_curl.dll
;extension=php_openssl.dll becomes extension=php_openssl.dll

Restarting your machine should implement these changes.

At this point it is useful to create a PHP file ‘phpinfo.php’ just containing the PHP code:

<?php
phpinfo();
?>

This will provide information on the system setup with respect to PHP. Setup your 'Test Web server' and open this PHP code file in your browser to confirm PHP is working on your system and the extension modules are recognised. Provided below is additional help in setting up your 'Test Web Server' on the two most popular servers used to test server side scripts locally.

IIS

To use the Esendex PHP SDK with IIS, carry out the following steps:

  1. Either copy the SDK directory structure to a folder in the IIS Default Web Site’s home directory or create a Virtual Directory under the IIS Default WebSite which points to the downloaded files ( localhost ).
  2. As a check copy the ‘phpinfo.php’ file to the directory and, using an internet browser open this file via its URL (e.g. http://localhost/phpinfo.php). The resultant page should contain PHP system info, including the versions of OpenSSL and cURL being used. If cURL and OpenSSL do not show in the page ensure that the prerequisites have been followed and restart the IIS service.

Apache 2

To use the Esendex PHP SDK with Apache, carry out the following steps:

  1. Download the Apache server installer from http://httpd.apache.org/download.cgi
  2. Either copy the PHP5Apache2.dll to a folder on the system path or amend the path to include the folder containing the PHP5Apache2.dll.
  3. Edit the ‘HTTPD.conf’ file adding the lines: LoadModule php5_module “PATH TO php5apache.dll”
    AddType application/x-httpd-php .php
  4. Port 80 may not be available. This will be evident when starting the Apache server from an error message. If this is the case change all instances of 80 in the .conf file to 8080. Apache should now be listening on port 8080.

    Add a Virtual Host by including the lines: <VirtualHost *>
    DocumentRoot PATH_TO_DIRECTORY_CONTAINING_PHP_FILES ServerName localhost
    <VirtualHost>
  5. This will direct the Apache server to the directory which we will put the Esendex PHP SDK files into.
  6. Restart the machine and copy the ‘phpinfo.php’ file to the DocumentRoot folder. Accessing this file using an internet browser, via it’s URL ( e.g. http://localhost/phpinfo.php ) should display system information for PHP. Included in this information should be the versions of cURL and OpenSSL being used.
  7. Copy the Esendex PHP SDK directory structure to the DocumentRoot folder.

Changes to the PHP SDK

The main change to the PHP SDK is that instead of using nusoap to communicate with webservices, HTTP form post is now used via cURL an OpenSSL. This provides reliable communications over both secure and non-secure services.

Functionality to enable a user to obtain the account message limits and other Account Services has been removed. A superior method for retrieving inbox messages has been added to the EsendexInboxservice.php class file.

The 5.1.1 PHP release required a change in the Esendex PHP SDK files so that the SDK worked with the latest most secure version of PHP. Although the updated SDK should work with older versions of PHP, we strongly recommend that you update to the versions specified in this document.

The Esendex scheduled send service has been added to allow customers to send messages at a specified date/time or by specifying a time period in days, hours and minutes.

The Esendex contact and subscription services have also been added to allow customers to manage their contacts/groups and subscriptions.