merc
merc

Reputation: 13

Making a web page "viewer"

I am making a web page viewer that sends requests from the server and outputs them into web page format, allowing the user to browse the web via this "mini web browser", however, I am running into difficulties. I am embedding the content via iFrame. I tried getting the web page content via CURL, but sites like Google gave me errors. And images looked broken because it thought the images were on my server, but actually on Google's. So it's trying to load resources locally. This is being written in PHP. How can I fix this? Thanks.

Upvotes: 1

Views: 405

Answers (1)

profitphp
profitphp

Reputation: 8354

Its not working because the content is probably using relative paths rather than absolute.

Add this at the top of the HTML.

<base href="http://www.abc.com/original/path">

Or you could check out using wget from the command line, with the -k switch. Which will actually add the full path in where it needs to. I imagine this will be problematic with poorly formed HTML though.

Upvotes: 1

Related Questions