将文档保存在PHP简单HTML DOM中

I have a problem with PHP simple HTML DOM.

The following to save the code in a text document ...

<?php 
include('simple_html_dom.php');
$a= file_get_html('http://web.com');
$a->save('text.txt');
?>

But only the first time creates it, if I try to update it appears not to overwrite

What could be the problem?

EDIT: the text file that is created is not updated when I run the PHP.

The website does change.

Why use simplehtmldom for this? It's massive overhead just to write out a file.

<?php
    file_put_contents('test.txt', file_get_contents('http://web.com'));

would accomplish the same thing

When you expect the output file to change, are you:

  1. Reloading the modified webpage $a = file_get_html('http://web.com');
  2. Modifying the object $a directly

If you are not doing 2), then as Marc B suggests, do not use simplehtmldom.
If you are doing 1), output $a, var_dump($a); as a first step to ensure that the object was actually modified.

yes, it is not changed becouse nothing else has also changed, in particular http ://web.com