english

learn php

learn css

learn html

learn javascript

learn php

15. code organization

assignments
2 minutes / 297 words

fifteen / assignments

assignment 15.1

this is an extension of assignment 8.1

write an email scraper that allows a user to enter a url and a number of pages to search then retrieves the page, parses for emails, follows the links and continues the process. you should have a set maximum number of pages so the user can't just tell it to go on forever.

ensure good code organization by separating this into multiple functions and files.

it should output a report of unique validly-formatted emails sorted alphabetically.

you can use this html as a starting point...

<form method="post" action="scrape.php">
    <input type="text" name="url" placeholder="http://php.org" /><br />
    <input type="number" name="depth" value="20" /><br />
    <input type="submit" value="scrape" />
</form>

assignment 15.2

this is an extension of assignment 15.1

extend your email scraper by creating a plain-text file of emails stored on the server that is added to with any new validly-formatted ones found in new searches.

instead of displaying a complete list every time, only show the new ones added.

add a separate function to display the whole list when the page is called with a code on the querystring.

assignment 15.3

this is an extension of assignments 12.1 and 12.2.

reorganize the code from these two assignments into something more manageable for maintenance.

for assignment 12.1, add automatic logging of all requests in a tab-delimited text file that is appended to every time a user does a search with all the search information and when it was performed.

the log should also include how long the search took to process from the time the page was submitted to when the output was sent back to the user after all the external requests were completed.

learn php

learn css

learn html

learn javascript

powered by akelei. an avi sato project.