Re: load a URL and trap output
| From: | Roger Spears | Date: | Fri, 12 Mar 2004 17:27:10 +0000 |
| Subject: | Re: load a URL and trap output | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180271@lists.php.net to get a copy of this message | ||
Tom Meinlschmidt wrote:
simple use fopen() or file() as $fp = fopen("http://somedomain/some.url?blablah","r"); and read via fread() Then I replied with:
Perhaps I was mistaken, I thought: $fp = fopen("http://somedomain/some.url?blablah","r"); fread(); Would just return the actual HTML code of the page and NOT the results of running the page?.?.?.?.? I will test it out and see. Thank you for your suggestion! Hello All,It seems fopen() did not work. However, it did stop the FORBIDDEN message I was receiving. So I think I'm on the right track. Here's what I tried... $filename = "actual URL"; $fd = fopen("$filename", "r"); $contents = fread($fd, $filename); fclose($fd); print strlen($contents); print "<p>".$contents; I can open the URL, that works ( fopen() ). I've tested out the fread(), file(), fgets(), and file_get_contents functions. Nothing works. I can close the URL, that works ( fclose() ). With each attempt, I get 0 for the strlen of $contents and nothing else prints out. I also tried adding this to the script right before fopen: ini_set('allow_url_fopen','1'); That didn't work either... Any idea(s) on what I'm doing wrong? I'm using php 4.3.3 and I believe it's Apache 1.3 Thanks, Roger