Reputation: 77
I have the PHP code as below:
<?php
$htmlFile = file_get_contents(http://archi-graphi.com/arcancianev/sejour-29-eau_turquoise_en_corse.html');
$pdfHtml = ('pdfFile.html');
copy($htmlFile, $pdfHtml);
// Now you can choose to run a check to see if the new copy exists,
// or you have the option to do nothing and assume it is made
if (file_exists($pdfHtml)) {
echo "Success : has been made";
} else {
echo "Failure: does not exist";
}
?>
But I got the error messages Warning: copy( <!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8" /> <title>Vacances Arcanciane</title> ...
I don know what is the error from.Anyone help me please,thanks.
Upvotes: 0
Views: 4276
Reputation: 1
Check the order of variables for the copy. It should be copy($pdfHtml, $htmlFile);
instead of copy($htmlFile, $pdfHtml);
Upvotes: -1
Reputation: 5896
Correct me if I'm wrong, but you're probably looking for file_put_contents instead of copy:
<?php
$html = file_get_contents('http://archi-graphi.com/arcancianev/sejour-29-eau_turquoise_en_corse.html');
$pdfHtml = 'pdfFile.html';
// this is probably what you're trying to do
file_put_contents($pdfHtml, $html);
// Now you can choose to run a check to see if the new copy exists,
// or you have the option to do nothing and assume it is made
if (file_exists($pdfHtml)) {
echo "Success : has been made";
} else {
echo "Failure: does not exist";
}
?>
Upvotes: 3