使用PHP的票务系统

时间:2012-03-28 13:09:24

标签: php email architecture service

我正在尝试制作一个票务系统,但有几种方法可以做到这一点。

管道

管道问题是尝试解析附件并将其保存到文件夹中。

这是我制作的一个小脚本

#!/usr/bin/php -q
<?php

//The concern here is having enough mem for emails with attachments.
ini_set('memory_limit', '256M'); 

ini_set("display_errors", "1");
error_reporting(E_ALL);

$data = isset($_SERVER['HTTP_HOST'])?file_get_contents('php://input'):file_get_contents('php://stdin');

$fdw = fopen("mail.txt", "w+");
fwrite($fdw, $data);
fclose($fdw);

?>

使用cPanel的管道进行编程。

它会生成一个原始电子邮件字符串,其中包含许多我不理解的内容。例如:

--_1f366895-b327-4f84-8985-e3826cdf604b_ Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="something.zip" UEsFBBQACAAIAJuy1DgAAAAAAAAAAAAAAAAKAAAAcmVwb3J0LnhtbNVdW5fbNpJ+n1/B9Z6zb8Mh rgTPJplGt9N2HNvxiTPjM/vGltjdinUbUrLT+fVLUqJEUKSAYoE0p+10YkIdfwCBQl2+qvru73+s lt6XJM0Dm/X3z4gfPPOyXbyex8vNOvn+2VOSPfv7D3/5y3dpst2kux++28V3y+SH72ab5X61zqr/ 8NbxKv/0PN4Dz3747m+Hh43BWbzaxouHdecH4vlDutlvO8c/J09fN+m8e/zryyTb/SNddn5isdpm

有没有办法解析它们(img,docs,zip等)或将它们放在文件夹/ something.ext中?

还有其他办法吗?

外部服务?

是否已经有一些服务呢?

1 个答案:

答案 0 :(得分:1)

首先在文件名后输出你的输出,然后用base64解码你的内容,因为你在标题中看到:Content-Transfer-Encoding: base64

file_put_contents('something.zip', base64_decode($output));
相关问题