function validateConvoId($convo_id) { $id = htmlentities($convo_id); return $id === $convo_id ? $convo_id : get_convo_id(); }
$url = 'http://api.program-o.com/v2.3.1/chatbot/'; $url = 'http://localhost/Program-O/Program-O/chatbot/conversation_start.php'; $url = 'chat.php'; */ $display = "The URL for the API is currently set as:<br />\n{$url}.<br />\n"; $display .= 'Please make sure that you edit this file to change the value of the variable $url in this file to reflect the correct URL address of your chatbot, and to remove this message.' . PHP_EOL; #$display = ''; $display_template = <<<end_display <span class="user_name">[user_name]: </span><span class="user_say">[input]</span><br> <span class="bot_name">[bot_name]: </span><span class="bot_say">[response]</span><br> end_display; $post_vars = !empty($_POST) ? filter_input_array(INPUT_POST) : array(); $get_vars = !empty($_GET) ? filter_input_array(INPUT_GET) : array(); $request_vars = array_merge($get_vars, $post_vars); $convo_id = isset($request_vars['convo_id']) ? $request_vars['convo_id'] : get_convo_id(); $bot_id = isset($request_vars['bot_id']) ? $request_vars['bot_id'] : 1; if (!empty($post_vars)) { $options = array(CURLOPT_USERAGENT => 'Program_O_XML_API', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true); $ch = curl_init($url); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POSTFIELDS, $request_vars); $data = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($data); $display = ''; $success = $xml->status->success; if (isset($xml->status->message)) { $message = (string) $xml->status->message; $display = 'There was an error in the script. Message = ' . $message; } else {