<html> <body> <form method="post"> ContactId: <input type="text" name="ContactId" value="<?php if (isset($_POST['ContactId'])) { echo $_POST['ContactId']; } ?> "><br/> Integration Name: <input type="text" name="IntegrationName" value="<?php if (isset($_POST['IntegrationName'])) { echo $_POST['IntegrationName']; } ?> "><br/> Goal Name: <input type="text" name="GoalName" value="<?php if (isset($_POST['GoalName'])) { echo $_POST['GoalName']; } ?> "><br/> <input type="submit"/> </form> <?php if (isset($_POST['ContactId'])) { var_dump(Infusionsoft_FunnelService::achieveGoal($_POST['IntegrationName'], $_POST['GoalName'], $_POST['ContactId'])); } ?> </body> </html>
// Check for required contactId if (!isset($_POST['contactId']) || !is_numeric($_POST['contactId'])) { die('Required parameter "contactId" is missing or invalid.'); } // Override default integration name if supplied if (isset($_POST['integration'])) { $options['integration'] = $_POST['integration']; } // Override default call name if supplied if (isset($_POST['callName'])) { $options['callName'] = $_POST['callName']; } // Check for start time if (isset($_POST['startTime'])) { $options['startTime'] = $_POST['startTime']; } // Check for stop time // It is assumed that the stop time is for the next day if stopTime < startTime if (isset($_POST['stopTime'])) { $options['stopTime'] = $_POST['stopTime']; } // Call the achieveGoal method if current time is between start/stop time if ($options['startTime'] > $options['stopTime']) { if (date("Hi") >= $options['startTime'] || date("Hi") <= $options['stopTime']) { Infusionsoft_FunnelService::achieveGoal($options['integration'], $options['callName'], $_POST['contactId']); } } else { if (date("Hi") >= $options['startTime'] && date("Hi") <= $options['stopTime']) { Infusionsoft_FunnelService::achieveGoal($options['integration'], $options['callName'], $_POST['contactId']); } }