2

I have a PHP script that dynamically creates a HTML file. In command line, I would like to load all elements in the HTML file. So let's say the HTML file has these elements: img src="http://www.test.com/image.php" ... iframe name="xxx" src="https://www.abc.com" ... I would like the Web servers test.com and abc.com to actually receive my request.

Is there a way to do that in command line? What I tried so far is to make my HTML accessible via my local Web server and fetch the file with "wget --mirror", but no success.

Thank you for your help.

4
  • You want to download the resources that are referenced in the source such as the image and iframe in your example, or you just want to hit those servers so that they see the requests? Commented Sep 16, 2010 at 20:05
  • I want to hit those servers only Commented Sep 16, 2010 at 20:07
  • Are you saying the HTML source file is local, but you'd like to download the associated components from remote servers? Commented Sep 16, 2010 at 20:09
  • Ok it works now, I had to add the option "--span-hosts" with wget to fetch external elements. Commented Sep 16, 2010 at 20:26

1 Answer 1

3

wget --mirror is definitely the way to go.

To make sure it loads the external references, add --page-requisites:

This option causes Wget to download all the files that are necessary to properly display a given HTML page. This includes such things as inlined images, sounds, and referenced stylesheets.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.