Here’s a very simple PHP sample to retrieve data from a specific lead’s profile from your contacts database.
<?php $ch = curl_init(); // CONNECT TO API, VERIFY MY API KEY AND PASSWORD AND GET THE LEAD DATA curl_setopt($ch, CURLOPT_URL,"https://app.kartra.com/api"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'app_id' => 'AIm863DwsOW', 'api_key' => 'QG9GPLW8G', 'api_password' => 'kdwFAfwrfVS', 'get_lead' => array( 'email' => 'JoeSmith@domain.com', ), ) ) ); // REQUEST CONFIRMATION MESSAGE FROM API… curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec ($ch); curl_close ($ch); $server_json = json_decode($server_output); switch ($server_json->status) { case "Error" : // process what error was about break; case "Success" : // after this you can use the info passed from kartra in your own scripts. // Ex: $server_json->lead_details contains the lead details break; } ?>