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 "


Link to comment
Share on other sites

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 "

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.