Jump to content
dontknowmuch

download and display HTML

Recommended Posts

You can use file_get_contents to get the contents of a file (oddly enough). If the server has it enabled, then you can also use file_get_contents with files starting with http. Some servers have that option disabled.

Share this post


Link to post
Share on other sites

I'm new so here's hoping I used the right button do do this reply...Is there any example code I can look at to see how the above is accomplished since it would seem with this method that I would end up getting only the HTML files after they had already been downloaded to server "B"...?

Share this post


Link to post
Share on other sites

if file_get_contents doesnt work you could juse use join('',file('http://path/to/file')); Then you could temporarily store the file on your server and use headers to force an application download on your server. Again, some servers may have this disabled. I believe allow_call_time_pass_reference is the PHP variable that controls this. You could set it to true and try the script if it doesnt work.

Share this post


Link to post
Share on other sites
Is there any example code I can look at to see how the above is accomplished since it would seem with this method that I would end up getting only the HTML files after they had already been downloaded to server "B"...?
That's what you asked for right?
Is there a script to do a server side download of an HTML web page
<?php$html = file_get_contents("http://www.google.com/index.html");echo "html: <br>" . nl2br(htmlentities($html));?>

Share this post


Link to post
Share on other sites
That's what you asked for right?
<?php$html = file_get_contents("http://www.google.com/index.html");echo "html: <br>" . nl2br(htmlentities($html));?>

Thanks for the code. I embedded it between <body> and </body> tags and tried it on two different servers, one Linux, the other UNIX. While it does not generate and error page, a blank page is all I get.The serves do not seem to be wired for PHP. I've tried some Javascript and it seems to work ok. What would be the equivalent code in Java, or should I ask this in the Java section?

Share this post


Link to post
Share on other sites

Well, first Java and Javascript are two totally separate, unrelated things. With Javascript you could use the XMLHTTPRequest object to get the file and write it out using document.write. That would not run it on the server though. I'm not sure what you would do for Java, I try to stay away from Java as much as possible.You can add this to the top of the PHP script to enable errors, you might be getting one and not seeing it.ini_set("display_errors", 1);error_reporting(E_ALL);Other then that, if you want to test that PHP is installed try putting this (alone) in a document and opening it with a browser:<?php phpinfo(); ?>It will be immediately obvious if PHP is installed.

Share this post


Link to post
Share on other sites
Well, first Java and Javascript are two totally separate, unrelated things. With Javascript you could use the XMLHTTPRequest object to get the file and write it out using document.write. That would not run it on the server though. I'm not sure what you would do for Java, I try to stay away from Java as much as possible.You can add this to the top of the PHP script to enable errors, you might be getting one and not seeing it.ini_set("display_errors", 1);error_reporting(E_ALL);Other then that, if you want to test that PHP is installed try putting this (alone) in a document and opening it with a browser:<?php phpinfo(); ?>It will be immediately obvious if PHP is installed.
Neither have any effect. I tried the info snippet with both standard generated HTML tags and with totally nothing else and I still get a blank page on the client even after clearing the buffer.So I guess this means that PHP is not supported on the server. Would you know of any servers that are setup to act in this capacity such that the URL can be provided through a form on client "x" that will direct server "B" to display the HTML web page from server "A"?

Share this post


Link to post
Share on other sites

The majority of web servers support PHP, PHP is the most popular Apache module out there. Most hosts have servers that support PHP, it's actually pretty unusual to see a Linux web server that does not have PHP installed, PHP was originally built to be run on Linux servers.You would want to talk to whoever is hosting the server for you and find out if you can use PHP on it, or else find a new host that will support it. There is a thread in the general forum where people list web hosts.

Share this post


Link to post
Share on other sites

At the moment I'm not looking for a hosting service but just the ability to view an HTML web page through a server that has been setup similar to the way some traceroute servers have been setup in that the trace originates from the server instead of from the client address. I am looking for servers that have been setup to provide the same service except for accessing HTML web pages from the server instead of doing a traceroute.

Share this post


Link to post
Share on other sites
Are you talking about a proxy server?
Essentially, yes. I guess my association with a proxy server is like an Internet server that has both an Internet and a local connection and does basically the same thing I'm trying to do except for the proxy server in this case not being a part of the local Internet but a server located somewhere else on the Internet. Makes sense that you would still call it a proxy server, its just that I never thought of it that way.So are there a bunch of them out there that do that very thing or is there no real need for an Internet based proxy service, excluding the Google server of course?

Share this post


Link to post
Share on other sites

I'm not sure if Google runs a proxy server or not, I don't think they do. There are plenty of internet proxy servers though, I guess it depends what you want to use it for. There are several types listed in the Wikipedia article.

Share this post


Link to post
Share on other sites

Okay, I found one... I was just looking for a public proxy server that would allow me to get around a block on a site where the top guy finally complied with a DMCA take down order that was necessary due to my account being disabled preventing me from accessing the material and making edits or deletions. He apologized for the delay and restored my access and then within about 12 hours I was unable to access anything on the site. This led to a traceroute and finally the discovery that there was a net block for a whole range of address, preventing me from changing addresses to overcome the block. Basically I just wanted to be able to contact him again and see if he had changed his mind or what the problem was since the only way was through the site message system since no email or fax number is provided for the site and to see what had happened to my other content. The site may actually be stealing ideas and content from users who post material through the wording of it Terms of Service agreement. It appears that in the comment sections for each publication there is a deliberate effort to antagonize the user through belittlement and other techniques in hopes of causing the user to utter a profanity or the like so the site can then justify cutting the user off and claiming ownership of his content. I haven't made a final determination but it would be a shame for such a nice site with such a high potential to be shut down for lack of integrity and theft.

Share this post


Link to post
Share on other sites

That's an interesting business plan. I doubt a TOS overrides federal copyright law, but good luck.

Share this post


Link to post
Share on other sites
That's an interesting business plan. I doubt a TOS overrides federal copyright law, but good luck.
I would doubt it too, but these guys are clever and know how the system works... corrupt attorneys or even Judges maybe under investigation right now.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...