/    Sign up×
Community /Pin to ProfileBookmark

HTML output to file from php-code

Hi Everyone!

I need to create HTML-files by invoking php-code. I need to run the script in batch – to create html for every php-option. 😮 !??

How can I do it?

(I’m using Linux, Apache and PHP – see below)

Can I use something like lynx, like:

[CODE]# batch-apache-equivalent –input=my_php_code.php –output=specified_html_file.html[/CODE]

What ideas do you have????

Look forward to your reply ?

regards

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsDec 19.2005 — example[code=php]<?php
$script = 'path/to/file.php';
$saveto = 'path/to/file.htm';

ob_start();
include($script);

$data = ob_get_contents();
ob_clean();
$fp = fopen($saveto, 'wb');

if(fwrite($fp, $data) > 0)
{
echo "data from $script was save to $saveto successfully";
}
fclose($fp);
?>[/code]
Copy linkTweet thisAlerts:
@GrahamBauthorDec 19.2005 — Well, ShrineDesigns!

That looks really neat! ?

I had not dreamt of using php code. Perhaps I can parameterise that, call it with lynx and and run it from a batch file.

Thank you!
Copy linkTweet thisAlerts:
@SpectreReturnsDec 19.2005 — The manual has a lot of information about commandline programming.
×

Success!

Help @GrahamB 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.19,
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,
)...