SchweppesAle Posted December 27, 2009 Share Posted December 27, 2009 Hi, I need to parse the all.txt document on the following page. http://www.robotstxt.org/dbexport.html the schema says that it's formatted as a RFC 822 message. so I tried using the following code $file = file_get_contents('http://www.robotstxt.org/db/all.txt'); echo var_dump(mailparse_rfc822_parse_addresses($file)); which then returns the following message: Fatal error: Call to undefined function mailparse_rfc822_parse_addresses() any ideas? PHP Version 5.2.10-2ubuntu6.3 Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/ Share on other sites More sharing options...
oni-kun Posted December 27, 2009 Share Posted December 27, 2009 You will need PECL mailparse >= 0.9.0 to be able to use mailparse_rfc822_parse_addresses It's telling you that it's undefined, so are you including the PECL file? Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984434 Share on other sites More sharing options...
SchweppesAle Posted December 27, 2009 Author Share Posted December 27, 2009 is this a php module i need to install or do I just include additional libraries? Never had to use pecl before Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984437 Share on other sites More sharing options...
SchweppesAle Posted December 27, 2009 Author Share Posted December 27, 2009 woohooo, got to love google. http://wiki.cerb4.com/wiki/Installing_PHP_Mailparse Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984440 Share on other sites More sharing options...
SchweppesAle Posted December 27, 2009 Author Share Posted December 27, 2009 damn, i spoke too soon. Anyone know how to parse the above txt file? I just need to store the data within an array so i can write a mysql insert. Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984449 Share on other sites More sharing options...
oni-kun Posted December 27, 2009 Share Posted December 27, 2009 damn, i spoke too soon. Anyone know how to parse the above txt file? I just need to store the data within an array so i can write a mysql insert. Explode should be the lowest level option, although I can tell you this'll take a certain long time to work.. Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984451 Share on other sites More sharing options...
SchweppesAle Posted December 27, 2009 Author Share Posted December 27, 2009 yea, i tried doing that. <pre> <?php $stream = fopen('all.txt', 'r'); $file = stream_get_contents($stream); $boom = explode("/n", $file); foreach($boom as $row) { if(preg_match('/robot-id/', $row)) { $newArray = $row; } } echo var_dump($newArray); ?> </pre> You'd think something like this would be placed within an xml file. This is not working >< Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984456 Share on other sites More sharing options...
SchweppesAle Posted December 27, 2009 Author Share Posted December 27, 2009 http://www.user-agents.org/ top left corner - xml yesss Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984486 Share on other sites More sharing options...
salathe Posted December 27, 2009 Share Posted December 27, 2009 I take it you no long want to parse the text file, or would you still like to do it as an academic exercise? Quote Link to comment https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/#findComment-984541 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.