custom_code/
directory.
new_chat_transcript.php
file. When the chat session ends, it will also process the new_chat_transcript.php
file.$formatted
= The complete transcript with formatted tags such as <span> and <div>. This contains extra data then just the messages (timestamp, line markers, tags, etc).$message_trans
= The chat transcript with all the extra data and tags removed. In most situations, use this variable as the chat transcript. The system also uses this variable when emailing chat transcripts to the visitor.$created
= The time the chat session was created, in unixtime format.$ended
= The time the chat session ended, in unixtime format.$deptid
= The ID of the department the chat was routed to.$deptinfo
= Array hash containing the department information. The MySQL table p_departments will show all the possible values.
$opid
= The ID of the operator that accepted the chat.$vname
= Visitor's name.$vemail
= Visitor's email.$question
= Visitor's question.$custom
= The custom variables, including custom fields (name/value pair). The name/value pair is in the format of: field1-_-value1-cus-field2-_-value2new_chat_transcript.php
file.<?php // always check if $deptinfo has content or it will produce error if key does not exist $department_name = isset( $deptinfo["name"] ) ? $deptinfo["name"] : "" ; $request = curl_init( "https://www.phplivesupport.com/api/create_ticket.php" ) ; curl_setopt( $request, CURLOPT_RETURNTRANSFER, true ) ; curl_setopt( $request, CURLOPT_CUSTOMREQUEST, "POST" ) ; curl_setopt( $request, CURLOPT_POSTFIELDS, array( "transcript"=>$message_trans, "visitor_name"=>$vname, "visitor_email"=>$vemail, "custom_variables"=>$custom, "department_name"=>$department_name ) ) ; /* set to true to use cert */ if ( false ) { /* cert (optional) */ curl_setopt( $request, CURLOPT_SSL_VERIFYPEER, true ) ; curl_setopt( $request, CURLOPT_CAINFO, "$CONF[DOCUMENT_ROOT]/mapp/API/cacert.pem" ) ; /* end cert */ } else { curl_setopt( $request, CURLOPT_SSL_VERIFYPEER, false ) ; } $response = curl_exec( $request ) ; $curl_errno = curl_errno( $request ) ; $status = curl_getinfo( $request, CURLINFO_HTTP_CODE ) ; curl_close( $request ) ; ?>