parser fixes + moved wp_update_post inside loop

* some fixes with the parser :
- try to fix bad HTML formatting
- single declaration of DOMdocument

* moved wp_update_post; which is now fired for each image.  So if the
script breaks, successfully downloaded remote images HAVE been replaced
in the post content.

* renamed some functions for good understanding.

* changed time limit to 120.