 |
hellkvist.org Discussions about the free software on hellkvist.org
|
| View previous topic :: View next topic |
| Author |
Message |
x-men Guest
|
Posted: Mon Feb 02, 2004 3:25 pm Post subject: Peffis: Any decent MMS encoding class-PHP? |
|
|
Peffis: Can you pls give me a link to any decent MMS encoding class in PHP?
I have been wandering for some time now, no luck so far...
I have come across some stupid tests, nothing really working..
Pls help
| Code: |
<html>
<head>
<title>TEST MMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
if ($HTTP_POST_VARS[go]==1) {
$mms="";
$mms= chr(0x8C);//mess type
$mms .= chr(0x84);//val message type
$mms .= chr(0x98);//mess tra id
$mms .= "1234";//message transaction id
$mms .= chr(0x00);//fine mess tra id
$mms .= chr(0x8D);//versione
$mms .= chr(0x90);//versione 1.0
$mms .= chr(0x85);//campo data
$mms .= chr(0x04);//campo data
$mms .= chr (hexdec(substr(dechex(time()),0,2)));
$mms .= chr (hexdec(substr(dechex(time()),2,2)));
$mms .= chr (hexdec(substr(dechex(time()),4,2)));
$mms .= chr (hexdec(substr(dechex(time()),6,2)));
$mms .= chr (0x89);//nome from
$mms .= chr (0x14);//from
$mms .= chr (0x80);//from
$mms .= "mms-editor@toolkit";//from
$mms .= chr(0x00);//fine from
$mms .= chr(0x97);//campo to:
$mms .= $HTTP_POST_VARS[to];
$mms .= chr(0x00);//fine
//echo "|";
//campo cc:
/*$mms .= chr(0x82);//
$mms .= $HTTP_POST_VARS[cc];
$mms .= chr(0x00);//fine
//echo "|";
//campo bcc:
$mms .= chr(0x81);//
$mms .= $HTTP_POST_VARS[bcc];
$mms .= chr(0x00);//fine */
//echo "|";
//campo ogg:
$mms .= chr(0x96);//
$mms .= $HTTP_POST_VARS[ogg];
$mms .= chr(0x00);//fine oggetto
//campo cont type
$mms .= chr(0x8A);
$mms .= chr(0x80);
$mms .= chr(0x8F);
$mms .= chr(0x80);
$mms .= chr(0x86);
$mms .= chr(0x81);
$mms .= chr(0x90);
$mms .= chr(0x81);
$mms .= chr(0x20);
$mms .= chr(0x00);
$mms .= chr(0x00);
$mms .= chr(0x84);
$mms .= chr(0xA3);
$mms .= chr(0x01);//<-- numero allegati
/*######################IT SEEMS WORK#################*/
//attatch a txt (it seems work)
//TESTO
$nome_allegato="1.txt";
$mms .= chr((44+(strlen($nome_allegato))*2)); //<-name file length
$mms .= chr((filesize ($nome_allegato))); //<-content length in bytes
$mms .= chr(0x83);//<--------Type
//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
//IMMAGINI
/*
$nome_allegato="ok.gif";
//--------Fine definizione Tipo
$mms .= chr((44+(strlen($nome_allegato))*2)); //<-name file length
//lunghezza contenuto
$i=0;
$size_c=42624+filesize ($nome_allegato);
echo "<hr>".($size_c)."<hr>";
while ((hexdec(substr(dechex($size_c),$i,2))) != "") {
echo "<hr>".hexdec(substr(dechex($size_c),$i,2))."<hr>";
$mms .= chr (hexdec (substr(dechex($size_c),$i,2) ) ); //<-lunghezza contenuto in bytes
$i=$i+2;
}
//PER .GIF o .JPG è sufficente cambiare il tipo
//$mms .= chr(0x9E);//<--------Tipo jpg
$mms .= chr(0x9D);//<--------Tipo gif
//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
//souno
//$nome_allegato="test_sound.amr";
$nome_allegato="ju45.amr";
//--------Fine definizione Tipo
$mms .= chr((53+(strlen($nome_allegato))*2) ); //<-name file length
$mms .= chr (129);
//lunghezza contenuto
$i=0;
$size_c=29693+filesize ($nome_allegato);
echo "<hr>".($size_c)."<hr>";
while ((hexdec(substr(dechex($size_c),$i,2))) != "") {
echo "<hr>".hexdec(substr(dechex($size_c),$i,2))."<hr>";
$mms .= chr (hexdec (substr(dechex($size_c),$i,2) ) ); //<-lunghezza contenuto in bytes
$i=$i+2;
}
$mms .= "audio/amr";
$mms .= chr(0x00);
*//
//--------------------------------
$mms .= chr(0x8E);//location
$mms .= $nome_allegato;//nomefile
$mms .= chr(0x00);
$mms .= "Content-ID";
$mms .= chr(0x00);
$mms .= "CID1";//ID del contenuto
$mms .= chr(0x00);
$mms .= chr(0xB0);
$mms .= "http://martin/catalog/".$nome_allegato;//URL
$mms .= chr(0x00);
$mms .= chr(0x92);
$mms .= chr(0x04);
$mms .= chr(0x3E);
$mms .= chr(0x70);//??
$mms .= chr(0xAC);//??
$mms .= chr(0x87);//??
//contenuto
$fp=fopen($nome_allegato,"r");
$contenuto = fread ($fp, filesize ($nome_allegato));
$mms .= $contenuto;
//----------------------------------------------
//----------------------------------------------
//----------------------------------------------
//----------------------------------------------
$fp=fopen("jonny.mms","w+");
fwrite($fp,$mms);
fclose($fp);
//foreach ($dati as $v) $mms .= $v;
echo "<hr>$mms<hr>";
#############################
function BinToAscii($data)
{
$char = 0;
$mydata="";
$len = strlen($data);
for($i=0;$i<$len;$i++) {
$char=ord(substr($data,$i,1)); // ascicode
$charhex = sprintf("%02X",$char%256);
$mydata = $mydata.$charhex;
}
return $mydata;
}
#################################
$hexa=BinToAscii($mms);
echo "<hr>$hexa<hr>";
echo "<hr>";
}
?>
<form name="form1" method="post" action="form.php" enctype="multipart/form-data">
TO: <input type="text" name="to"><br>
CC: <input type="text" name="cc"><br>
BCC: <input type="text" name="bcc"><br>
Oggetto: <input type="text" name="ogg"><br>
Imagine: <input type="file" name="immagine"><br>
Imagine: <input type="file" name="immagine2"><br>
Testo: <input type="file" name="testo">
<input type="hidden" name="go" value="1">
<input type="submit" name="Submit" value="GO!!!">
</form>
</body>
</html>
|
|
|
| Back to top |
|
 |
Peffis Site Admin
Joined: 09 Sep 2003 Posts: 324 Location: Sweden
|
Posted: Mon Feb 02, 2004 9:04 pm Post subject: |
|
|
| I don't think there is one judging by how many questions I receive about that all the time on email. At least not an open sourse one. Nokia has some closed source Java tool/api (downloadable in their developer's zone) that does it but I have never used it as it has never been in my interest to do so. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|