views:

76

answers:

1

I have made the following webpage for generating interactive todo lists: http://robert-kent.com/todo/todo.php

Basically, the user pastes a numbered todo list and each task is placed into it's own div with a unique id. Users can add notes to the tasks (done with javascript) and can click the green check when the task is done to hide it.

I'd like to add an Export button which would generate a report of which tasks were completed and which were not, along with the user-entered notes. After a bit of searching I understand that what I want to do is scrape the page, but I haven't the faintest idea of the best way to do it. Many of the articles and tutorials I have found with Google involve scraping other sites and don't really explain how I could iterate over each div on the page.

Full source here: http://pastebin.com/r7V3P5jK

Any suggestions?

A: 

The approach to providing an "Export" feature you've described is, unfortunately, completely wrong. Your page should submit back to the server with a parameter indicating that an "export" is desired. The server should then set the "Content-Disposition" header to something like attachment; filename="export.txt" (or whatever you want the filename to be).

Pointy