org/software/).
You can use MMSLib to create MMS messages through a script??”including
text and images at run time.
Time for Action: Decoding an MMS Message
1. Download and extract the MMS Decoder library to the POTR web directory.
The heart of the library is a file called mmsdecoder.php. Open the file and
turn on debugging by defining the DEBUG constant as 1 near the start of
the file.
2. Create a new file??”decodeMMS.inc.php??”and include the mmsdecoder.
php file. Then let's decode user.mms??”an MMS file we have got. Calling the
parse() method on the decode will process the MMS message and create
different parts for the content in it. The code for this would look like:
require_once("mmsdecoder.php");
$mmsFile = "user.mms";
Chapter 7
[ 135 ]
$mmsData = file_get_contents($mmsFile);
$mms = new MMSDecoder($mmsData);
$mms->parse();
3. Luigi wants to put up photos of his customers eating his pizzas along with
their testimonials! So we are looking for a photo and a text in the MMS
message. We can loop through the message parts, check the content type of
each part, and save the photo if it is an image. As we are looking for only one
image and one text data section, we can skip processing the other parts once
we have got them.
Pages:
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182