<?
/*
This sample uses the dBug.php class available on this site (http://www.phpclasses.org/) for array visualization.
*/
include("floSIP_Packet.php");
$sip = new floSIP_Packet();
if ($_POST["message_text"]) {
$sip->to_array(stripslashes($_POST["message_text"]));
}
if ($_POST["header"] || $_POST["header_value"]) {
$sip->header_update(stripslashes($_POST["header"]), stripslashes($_POST["header_value"]), stripslashes($_POST["header_where"]));
}
?>
<html>
<head>
<title>floSIP Sample</title>
<style>
* {
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<?
if ($sip->parse_error) {
?><b><?=$sip->parse_error?></b><?
}
?>
<form action="sample.php" method="post">
SIP Message:<br>
<TEXTAREA name="message_text" rows=25 cols=80><?=str_replace("<", "<", str_replace("&", "&", $sip->message_stream))?></TEXTAREA><br><br>
Update Header:<br>
<input type="text" name="header"> => <input type="text" name="header_value"> <select name="header_where"><option value="0">Add/Replace</option><option value="-1">Insert Above</option><option value="1">Insert Below</option></select> <input type="submit" value="Go">
<br><br>> SIP => The sip header is the whole first line.<br>
> => The blank header is a shortcut for the body when inserting/adding.<br>
All other headers are used as-is.
</form>
<?
include("dBug.php");
$dBug = new dBug($sip->message_array);
?>
</body>
</html>
|