PHP Classes

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  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: 9 years ago
Size: 1,458 bytes


Class file image Download
This sample uses the dBug.php class available on this site ( for array visualization.

$sip = new floSIP_Packet();
if (
$_POST["message_text"]) {
if (
$_POST["header"] || $_POST["header_value"]) {
$sip->header_update(stripslashes($_POST["header"]), stripslashes($_POST["header_value"]), stripslashes($_POST["header_where"]));

    <title>floSIP Sample</title>
        * {
            font-family: Arial;
            font-size: 10pt;

if ($sip->parse_error) {

<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.

$dBug = new dBug($sip->message_array);