Jump to content

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

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.