cooldude832 Posted December 4, 2007 Share Posted December 4, 2007 This is the first php script I'm really passing on to another person to use is what I am doing okay? Its a reverse engineering of emails, it phrases a batch of emails in reverse and then stores them in an array shaped like this $data[$email_number]['Header_data']['Header fields'] $data[$email-Number']['Body_data']['Reversed Fields']; So he can run a foreach loop on it, but is this okay to do? Quote Link to comment Share on other sites More sharing options...
btherl Posted December 5, 2007 Share Posted December 5, 2007 Can you show a bit of sample data? One line from the header data and body data should be enough. I don't yet understand the data structure. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 5, 2007 Author Share Posted December 5, 2007 well its a reversed engineered email so I can't give you the code, but the data is like Array ( [0] => Array ( [items] => Array ( [0] => Array ( [Description] => SWEETHEART ROSE BOUQUET - 18 STEMS W/VASE ) ) [shipping_Address] => [subtotal] => $29.99 [shipping_cost] => $10.99 [Tax] => $0.00 [Total] => $40.98 [billing_Address] => [Order_number] => W00442101216543 [Purchase_date] => 11/29/2007 [Purchaser] => XXXXXX@gmail.com [Merchant] => flowers1800 ) [1] => Array ( [Purchase_date] => 11/26/2007 [Order_number] => [Total] => $36.48 [subtotal] => $24.99 [Tax] => $1.50 [shipping_cost] => $9.99 [shipping_method] => USA Overnight [items] => Array ( [0] => Array ( [Description] => Resident Evil 4 Wii Edition- - $5 Off! [Qty] => 1 [Cost] => $24.99 ) ) [Purchaser] => XXXXXXX@gmail.com [Merchant] => Gamestop ) [2] => Array ( [billing_address] => [shipping_address] => [Total] => $20.00 [Order_number] => XXXXXXX [shipping_method] => Standard [subtotal] => $10.80 [shipping_cost] => $9.20 [items] => Array ( [0] => Array ( [Description] => Griffin 8127-5GSTRLNB Streamline Armband for iPod Classic and iPod 5G (Black) ) ) [Purchase_date] => 11/28/2007 [Purchaser] => *******p@gmail.com [Merchant] => Amazon ) [3] => Array ( [Purchaser] => *******@gmail.com [Merchant] => DrsFosterSmith ) [4] => Array ( [Purchaser] => *******@gmail.com [Merchant] => vmoda ) [5] => Array ( [Order_number] => XXXXXXXX [items] => Array ( [0] => Array ( [Qty] => 1 [Description] => Saitek A100 MySpkr Personal Stereo Speaker ) ) [Purchase_date] => 10/19/2007 [Total] => $17.99 [Purchaser] => ********@gmail.com [Merchant] => Woot ) Quote Link to comment Share on other sites More sharing options...
Distant_storm Posted December 5, 2007 Share Posted December 5, 2007 what the funk is reversed engineered email :S Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 5, 2007 Author Share Posted December 5, 2007 You take a message and extract what you want out of it and database it. So if i wanted to get all my phpfreaks personal message alerts logged in my mysql I could open my email account and read those emails phrase them with php using the patterns of the message, and then store it Quote Link to comment Share on other sites More sharing options...
Distant_storm Posted December 5, 2007 Share Posted December 5, 2007 ahh get you very clever, I never saw any reason why code couldn't be passed on aslong as your the one that produced it. Quote Link to comment Share on other sites More sharing options...
btherl Posted December 5, 2007 Share Posted December 5, 2007 Ok that structure makes sense. What makes you think it might not be ok to pass it to another programmer? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 5, 2007 Author Share Posted December 5, 2007 because I never passed it and my methods to doing stuff is well different than normal so I want to see if another person could use it. I see a foreach loop on it testing if errors/matching email will make it super easy to sql insert. Quote Link to comment Share on other sites More sharing options...
btherl Posted December 5, 2007 Share Posted December 5, 2007 I think that's a very natural data structure. I use similar structures all the time in my own code. While it's not memory efficient, it's very easy to understand and use. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 5, 2007 Author Share Posted December 5, 2007 I agree its not the best memory use, but I couldn't find a better way to do it that would be easy to handle. The data in a single message will be less than 50 nodes so I don't expect a memory issue Quote Link to comment 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.