Jump to content

need PHP to convert email to XML and upload to SQL data base


Arbtrader

Recommended Posts

I have managed to figure out by using filters from my CPanel maybe the best method to PIPE email content to text file . But I have an issue on getting this data parsed and sent data base. Below is an example of an email that send each morning and I need this figure imported to my database I was thinking of using a PHP script to carry out the parsing to XML and then importing data to DATABASE. I was going to use a custom pearl script with AWK But sometimes there will be less lines then other days under each of the 2 headers. Which is why im going for a direct PHP method. Is anyone able to help me set this up .


1.Extract email body to file. 2.convert to XML 3.Import to sql database.


Here is the content of the email below ( max lines under header of the 2 headers is 8)


New pending orders


Pair | Direction | Entry | SL | TP | Expiration


USDCHF | BUYSTOP | 0.9513 | 0.9365 | 0.9581 | 2015.02.26 23:59 USDCAD | BUYSTOP | 1.2501 | 1.2300 | 1.2638 | 2015.02.26 23:59 EURUSD | SELLSTOP | 1.1330 | 1.1488 | 1.1222 | 2015.02.26 23:59 EURJPY | SELLSTOP | 134.52 | 136.22 | 133.42 | 2015.02.26 23:59


Total Pending Orders = 4


Current Open positions


Pair | Direction | Entry | SL | TP


USDJPY | BUY | 119.40 | 118.11 | 120.66 USDCHF | BUY | 0.9513 | 0.9365 | 0.9617 USDCAD | BUY | 1.2501 | 1.2349 | 1.2645 GBPJPY | BUY | 183.72 | 182.60 | 186.32 EURJPY | SELL | 134.52 | 135.26 | 132.74


Total Open Positions = 5 "


sorry the email content is as below 

 

New pending orders

Pair | Direction | Entry | SL | TP | Expiration

USDCHF | BUYSTOP | 0.9513 | 0.9365 | 0.9581 | 2015.02.26 23:59

USDCAD | BUYSTOP | 1.2501 | 1.2300 | 1.2638 | 2015.02.26 23:59

EURUSD | SELLSTOP | 1.1330 | 1.1488 | 1.1222 | 2015.02.26 23:59

EURJPY | SELLSTOP | 134.52 | 136.22 | 133.42 | 2015.02.26 23:59

Total Pending Orders = 4

Current Open positions

Pair | Direction | Entry | SL | TP

USDJPY | BUY | 119.40 | 118.11 | 120.66

USDCHF | BUY | 0.9513 | 0.9365 | 0.9617

USDCAD | BUY | 1.2501 | 1.2349 | 1.2645

GBPJPY | BUY | 183.72 | 182.60 | 186.32

EURJPY | SELL | 134.52 | 135.26 | 132.74

Total Open Positions = 5 "

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.