PHP Script Repair Needed
Budget: $30 – $250 USD
I have an original script that was working fine but had an external dependancy that has been shut down. so the script has stoped working. what we need is to subsistitute the external dependancy with a local solution so we dont depend on 3rd party services
the specific problem function in the script is located in the email-filter.php file
function ParseEmail($content)
{
$postData = Array(
"raw" => $content
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.mimedecoder.com/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);
return json_decode($page, true);
}
as you can see it depends on https://www.mimedecoder.com/ and that has been shit down ..
here is the original proyect desciption so you can understand what the script does. and attached are the original script files
Hello
we need to create a php script that will receive emails piped to the script and will parse the email.
each time an email arrives the script should run, parse the email, extract pertinent information such as
- FROM
- TO
- SUBJECT
- MESSAGE BODY
- ATTACHMENTS
the script must add an entry to a mysql database for each email with the extracted information, a unique id, and a timestamp.
the emails the script will receive are always two different versions of emails.
one version will have a TXT file attached
the second version will always have 2 PDF files attached.
all 3 files are pertaining to the same transaction.
the script must also download any attachments and save them to a directory on our server. a url link and an absolute path to the ile must also be stored in a separate table in the database. these attachments must contain the unique id of the email where the attachment was received.
attachments will be in txt file format or PDF format. any other format must be ignored.
if the email has a TXT attachement:
once the txt file has been downloaded and the entry to the mysql database has been completed, the script must then parse the txt file and extract various fields from the file. the txt file is always structured in the exact same way and will get the fields in a fixed length field. so for example. field A will be the first 20 characters of the line, field B will be the next 5 characters and field C will be the next 8 characters.
the txt file will have multiple lines. this will vary. and custom php code must be executed for each line in the txt file using the fields extracted from each line. this custom code will be added by us after script has been tested.
once the script has completed processing the email and the txt file attached to it, a email must be sent to our admin with a log of the transaction stating how many lines were processed and the fields for each line in a sort of transaction report.
if the email has a PDF ATTACHMENT the pdf must be stored in our server and the entry added to the mysql table as stated before. no other function is needed
i have attached an example of the TXT ffile. the format will always be exaclty the same. the only thing that will vary is the information in the fix field structure and the ammount of lines in each file.
PLEASE DO NOT BID BEFFORE READING THE COMPLETE REQUIREMENT
please ask any questions via chat.
you will NOT be granted access to our production server so this script MUST include any dependancy libraries linked using relative paths and must run on a CPANEL hosting server. all testing must be done on your server.
all payments will be done via milestones.
we will not release payment until milestone is complete.
emails will be piped to the script. the script will not have access to the inbox. so the script must not work by going into the inbox via imap or pop. the script must work via a piped email
once selected. i will forward you 2 example emails of what the cript will parse.
the specific problem function in the script is located in the email-filter.php file
function ParseEmail($content)
{
$postData = Array(
"raw" => $content
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.mimedecoder.com/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);
return json_decode($page, true);
}
as you can see it depends on https://www.mimedecoder.com/ and that has been shit down ..
here is the original proyect desciption so you can understand what the script does. and attached are the original script files
Hello
we need to create a php script that will receive emails piped to the script and will parse the email.
each time an email arrives the script should run, parse the email, extract pertinent information such as
- FROM
- TO
- SUBJECT
- MESSAGE BODY
- ATTACHMENTS
the script must add an entry to a mysql database for each email with the extracted information, a unique id, and a timestamp.
the emails the script will receive are always two different versions of emails.
one version will have a TXT file attached
the second version will always have 2 PDF files attached.
all 3 files are pertaining to the same transaction.
the script must also download any attachments and save them to a directory on our server. a url link and an absolute path to the ile must also be stored in a separate table in the database. these attachments must contain the unique id of the email where the attachment was received.
attachments will be in txt file format or PDF format. any other format must be ignored.
if the email has a TXT attachement:
once the txt file has been downloaded and the entry to the mysql database has been completed, the script must then parse the txt file and extract various fields from the file. the txt file is always structured in the exact same way and will get the fields in a fixed length field. so for example. field A will be the first 20 characters of the line, field B will be the next 5 characters and field C will be the next 8 characters.
the txt file will have multiple lines. this will vary. and custom php code must be executed for each line in the txt file using the fields extracted from each line. this custom code will be added by us after script has been tested.
once the script has completed processing the email and the txt file attached to it, a email must be sent to our admin with a log of the transaction stating how many lines were processed and the fields for each line in a sort of transaction report.
if the email has a PDF ATTACHMENT the pdf must be stored in our server and the entry added to the mysql table as stated before. no other function is needed
i have attached an example of the TXT ffile. the format will always be exaclty the same. the only thing that will vary is the information in the fix field structure and the ammount of lines in each file.
PLEASE DO NOT BID BEFFORE READING THE COMPLETE REQUIREMENT
please ask any questions via chat.
you will NOT be granted access to our production server so this script MUST include any dependancy libraries linked using relative paths and must run on a CPANEL hosting server. all testing must be done on your server.
all payments will be done via milestones.
we will not release payment until milestone is complete.
emails will be piped to the script. the script will not have access to the inbox. so the script must not work by going into the inbox via imap or pop. the script must work via a piped email
once selected. i will forward you 2 example emails of what the cript will parse.