Drupal equivalent of wget (with permissions)? I'm working on a drupal 6 module and need a way to save a static html version of a node to the server, using the user's permissions.  Basically I need the equivalent of "wget -O out.htm http://mydrupalsite.org/node/1635" in drupal, that uses the activating user's permissions and login, but don't know enough about drupal to make this work without some pointers in the right direction.  I've looked through the functions list and the module code for http://drupal.org/project/print, but no luck.  Any help?

Thanks in advance.

EDIT: Clarification:  What I'm trying to accomplish is have a sidebar link for users to use that saves a copy of the current page -exactly as apache just sent it the user- to the server.  I'm trying to do this through drupal -without- using wget or any other system utility.
Is this for your site users to have a preview a static html page or node on your site?!


Cant you use drupal_render at a custom menu callback URL or Rule to get the HTML generated for 1 of your pages and save it to a file in your webroot or sites/all/files/SOMEDIR
then using RewriteCond in your Apache site configuration to ignore these static files so you can access them via a non-drupal URL ...
In drupal 7 at least there is like function node_view that lets you load a node for viewing, it respects user access rigts for visibility of stuff on the node.


There are programmatic ways to create and load a user (with assigned roles as well) in any version of Drupal. So you could tie all these bits together as:

Generate HTML fragment of node/page logic could be:


switch to some user by UID.
node_load() some node owned by user NID.
node_view() the node contents as some user.
drupal_render() get the raw HTML.
save to some filesystem location as .HTML file.