HEALTH WARNING: This method is designed to be used only by customers who are confident with web scripting languages such as PHP, because you need to write some simple code that will gather information from an HTML form that you've created and send it to our API. If you're not confident that you can do this yourself, you can send your website developer to this page to read this guide.
Information is sent to the Light Blue API using an HTTP POST request to https://online.lightbluesoftware.com/api.php .
The POST request must contain the following key-value pairs:
The Light Blue API expects data to be sent as UTF-8. Data sent using other text encodings is likely to cause problems or require manual tidying when its imported into Light Blue.
The Light Blue API will return a status code and, if an error occurred, a summary of that error. The list of status codes will be expanded as the API evolves.
The following PHP sample code uses curl to send a contact name, shoot date, enquiry source and shoot notes to the Light Blue API. Using cURL requires PHP 4.0.2 or later, and PHP needs to have been compiled with the libcurl package. In our experience, most web hosts that offer PHP support include curl.
<?php // Build a key-value pair array to be sent to the Light Blue API $data = array( // You must supply the API key displayed on your account page "Key" => "<YOUR API KEY>", // You must supply an API request type "Type" => "contact form", // If you want to use US-style dates, specify mm/dd/yyyy "DateFormat" => "dd/mm/yyyy", // Data from your form "ContactNameFull" => "Andrew Sample", "ShootDate" => "01/01/2014", "ShootEnquirySource" => "Advert in What Picture magazine", "Message" => "We're looking for a photographer." ); // Set up curl $curl_connection = curl_init("https://online.lightbluesoftware.com/api.php"); curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, True); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, True); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); // Use curl to send the array to the Light Blue API curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $data); $result = curl_exec($curl_connection); curl_close($curl_connection); ?>