Arbtrader Posted March 2, 2015 Share Posted March 2, 2015 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 " 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 " Quote Link to comment https://forums.phpfreaks.com/topic/295012-need-php-to-convert-email-to-xml-and-upload-to-sql-data-base/ Share on other sites More sharing options...
Arbtrader Posted March 2, 2015 Author Share Posted March 2, 2015 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 " Quote Link to comment https://forums.phpfreaks.com/topic/295012-need-php-to-convert-email-to-xml-and-upload-to-sql-data-base/#findComment-1507222 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.