1 # http\Message http\Message::splitMultipartBody()
3 Splits the body of a multipart message.
4 See http\Message::isMultipart() and http\Message\Body::addPart().
12 * http\Message, a message chain of all messages of the multipart body.
16 * http\Exception\InvalidArgumentException
17 * http\Exception\BadMethodCallException
18 * http\Exception\BadMessageException
23 $body = new http\Message\Body;
24 $body->addPart(new http\Message("Content-type: text/plain\n\nHello "));
25 $body->addPart(new http\Message("Content-type: text/plain\n\nWorld!"));
27 $msg = new http\Message;
28 $msg->setHeader("Content-Type",
29 "multipart/mixed; boundary=" . $body->getBoundary());
31 var_dump($msg->isMultipart($bnd), $bnd);
33 $parts = $msg->splitMultipartBody();
34 var_dump(count($parts));
35 foreach ($parts->reverse() as $part) {
36 echo $part->getBody();
43 string(17) "16658735.3fe37486"