VerticalResponse API PHP Sample Code
Overview
This is a sample application that demonstrates how to build basic functionality using the VerticalResponse API in PHP. You can email API Support at api-support@verticalresponse.com if you have any questions.
This application implements the following functionalities:
- Logging into the VerticalResponse system and obtaining a Session ID
- Creating a list
- Adding a record to that list
- Creating an email campaign
- Sending a test of your email campaign
- Attaching your list to that email campaign
- Launching your email campaign
Prerequisites & Notes
- Create a Vertical Response account (http://www.verticalresponse.com/)
- Fill out the API Access Request Form to have API enabled for your account.
- If you are a VerticalResponse partner, you were provided SSL certificates and a passphrase. You will need to install and configure these before making any administrative calls or calls on behalf of subaccounts.
- NOTE: This sample code does not include any Partner-specific methods, so you can run this code independent from setting up your certificates.
- The sample was tested on Mac OS X and will work on PHP 5 and above.
PHP Configuration
PHP must be configured with the following parameters:
-- with-openssl
-- enable-soap
Also recommended:
-- with-curl
In addition, the following param must be turned on for SOAP to be able to read files over the internet:
allow_url_fopen = On
After recompiling PHP, phpinfo() should echo something like the following:
Registered PHP Streams => php, file, http, ftp, compress.zlib, https, ftps
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*
... with at least the https stream and the ssl socket parameters.
Running the sample code
- Download and extract the VerticalResponse PHP Sample Code.
- Update the file vrapi_php_sample_code.php with your account username and password around lines 17 and 18.
- The sample code will by default send the test and launched email campaigns to the email address that is your username. You can update that email address around line 19.
- Run it! You'll receive two test emails, a launch report, and the launched email.