/    Sign up×
Community /Pin to ProfileBookmark

export page in html

Hi everybody.
I want realize a php page with a botton that allow to export the same page in html format.
Like the action of the browser menu file–>save page as
Can you help me????
many thanks

stefano

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@themartySep 22.2006 — this is the idea:

[code=php]<?php
if (isset($_GET['download']))
{
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header ("Content-type: text/html");
header ("Content-Disposition: attachment; filename=blaat.html");

include "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
exit;
}
?><html>
<head>
<title>download me</title>
</head>
<body>
blaat<br>
<a href="dl.php?download">download me</a>
</body>
</html>[/code]
Copy linkTweet thisAlerts:
@superst3authorSep 22.2006 — thank a lot.

Now i have only a linux station.,but can i use this script with Internet Explorer??

it is compatible???

thanks

stefano
Copy linkTweet thisAlerts:
@themartySep 22.2006 — all that cache-control **** only serves one purpose: to make it compatible with Internet Explorer ;-)

Decent browsers don't need it.
Copy linkTweet thisAlerts:
@superst3authorSep 22.2006 — this script save a page correctly if contain only text but if i have images and using css????

is possible save also all the pages information like image script css etc.. like the browser menu action??

thanks

stefano
Copy linkTweet thisAlerts:
@themartySep 26.2006 — the easiest way to achieve that, would be to define all the urls to stylesheets, javascript and images with the complete path (http://www.yourdomain.com/images/etc.gif), or simpy include a <base href="http://http://www.yourdomain.com/"> tag.

You won't actually save the css & images that way, but when you load the page from your harddisk, the css & images will be loaded from the internet and displayed
×

Success!

Help @superst3 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...