View Full Version : getting http://
04-18-1999, 02:37 PM
I'm new at php (what a great language).
Anyways, I want to call a remote page(a http:// something) and print it out. Everyone I've asked says "use fopen". I tried and even got it working on local files. But it never works on http:// files(no errors, the page is blank). Would someone be kind enough to give me working code?
04-18-1999, 04:05 PM
I honestly don't know if you can include a page from another site that's not on the same server - what I do know is that using any type of file opening command will not work. Your script will not be given permission to "open" a file on another server.
If it were to work, it would be basically where your script retrieves the page like a browser would - the only way an outside server would allow it. So if there is a way (I'm sure there must me), it would only include what a browser would see - eg, no php code, SSI's, etc.
Wish I could help more... http://www.aota.net/ubb/smile.gif
Who's up for rewriting the LWP modules in PHP? *evil grin*
--I think I'm cracking up--
Now that I'm back home with my bookmarks...
fopen() will indeed call a remote URL, if the first argument begins with http:// For example;
$remote_page = fopen("http://www.downinit.com/index.shtml", "r");
(I assume that the second argument needs to be 'r', for read-only).
The main problem with this (as near as I can tell) is that it opens the connection using HTTP/1.0. The reason that may be a problem: http 1.0 does not work with Virtual Hosting (an http 1.1 feature). FQuest makes use of the 1.1 protocol to host our accounts, as do many many other hosts in the market (it's an incredible cost saver, as there's no need to purchase an individual IP address for each domain, very expensive stuff! Most browsers support http/1.1 now, so it's usually not a big deal). I imagine PHP will handle HTTP/1.1 soon, but I have no idea when (although you may want to email someone at php.net and ask?).
--not to put to fine a point on it--
vBulletin® v3.6.8, Copyright ©2000-2013, Jelsoft Enterprises Ltd.