Jump to content

How to parse RFC 822 messages


SchweppesAle

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/186422-how-to-parse-rfc-822-messages/
Share on other sites

:wtf:

 

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

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 ><

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.