Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Joshua hatfield  >  floSIP Packet  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: A sample file showing how to access the main features of the class.
Class: floSIP Packet
Generate SIP (Session Initiation Protocol) packets
Author: By
Last change: Added not about dBug.php being needed for the sample.
Date: 8 years ago
Size: 1,458 bytes
 

Contents

Class file image Download
<?
/*
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("<""&lt;"str_replace("&""&amp;"$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>