Ejemplo n.º 1
0
<?php

/**
 * If the URL to this script is used as the MMSC url, the MMS messages 
 * will be saved in the same directory with the unix timestamp as filenames. 
 *
 * Copyright (c) 2004 Jonatan Heyman
 */
require_once "../mmsdecoder.php";
// check that something has actually been sent to the script
if ($HTTP_RAW_POST_DATA != "") {
    // parse MMS
    $mms = new MMSDecoder($HTTP_RAW_POST_DATA);
    $mms->parse();
    // The MMS is parsed, so let's get the mms data from the class by the print_r() function,
    $mmsdata = print_r($mms, true);
    $filename = time();
    // make sure the file is writable
    if (is_writable($filename)) {
        // write mms data to file
        $file = fopen($filename, "w");
        fwrite($file, $mmsdata);
        fclose($file);
    }
    // send confirmation response
    header('Content-type: application/vnd.wap.mms-message');
    $mms->confirm();
} else {
    echo "This script should be accessed by an MMS client, wich shoul send MMS data!";
}
Ejemplo n.º 2
0
require_once "../mmsdecoder.php";
?>

<html>
<head>
	<title>MMS Decoder - Debug tool, file upload</title>
</head>
<body>

This is a tool created to help in development of MMS decoding. Just upload a file
containing the raw MMS data and the results will be printed.

<br><br>

<form action="mmsfile.php" method="POST" enctype="multipart/form-data">
	File <input type='file' name='mmsfile'>
	<input type='submit' value='Upload and decode'>
</form>
<br><br>


<?php 
if (isset($_FILES["mmsfile"])) {
    $mms = new MMSDecoder(file_get_contents($_FILES["mmsfile"]["tmp_name"]));
    $mms->parse();
}
?>

</body>
</html>
	
Ejemplo n.º 3
0
require_once '../mmsdecoder.php';
require_once 'config.php';
require_once 'functions.php';
if ($HTTP_RAW_POST_DATA != "") {
    // check if the raw post data shall be saved
    if (SAVE_RAWDATA) {
        // save RAW data
        $data = $HTTP_RAW_POST_DATA;
        $filename = md5($data . time() . rand(1, 1000));
        $file = fopen($filename, 'wb');
        fwrite($file, $data);
        fclose($file);
        $info = print_r($_SERVER, true);
        $file = fopen($filename . "_info", 'wb');
        fwrite($file, $info);
        fclose($file);
    }
    // parse MMS
    $mms = new MMSDecoder($HTTP_RAW_POST_DATA);
    $mms->parse();
    // connect to database
    db_connect();
    // save mms and it's parts
    mms_save($mms);
    // close db connection
    db_close();
    // set header
    header('Content-type: application/vnd.wap.mms-message');
    // send confirmation response
    $mms->confirm();
}
 * You should have received a copy of the Affero General Public
 * License in the COPYING file that comes with The Affero Project; if
 * not, write to Affero, Inc., 510 Third Street, Suite 225, San
 * Francisco, CA 94107 USA. 
 */
/**
 * Programmer: Jonatan Heyman <http://heyman.info>
 * 
 * Description: This is a simple example how you can retrieve an MMS and just
 * 		save the image parts as files (in the same directory as the script).
 */
// includes
require_once '../mmsdecoder.php';
if ($HTTP_RAW_POST_DATA != "") {
    // parse MMS
    $mms = new MMSDecoder($HTTP_RAW_POST_DATA);
    $mms->parse();
    // loop thru parts and save images as files on the server
    foreach ($mms->PARTS as $part) {
        switch ($part->CONTENTTYPE) {
            case "image/jpeg":
                $fileext = ".jpg";
                break;
            case "image/png":
                $fileext = ".png";
                break;
            case "image/gif":
                $fileext = ".gif";
                break;
            default:
                $nopic = true;