|
-
Oct 21st, 2002, 12:44 AM
#1
Thread Starter
PowerPoster
Including External files
OK I have a PHP page where I want to include data from an external server. The php documentation says that this will work:
PHP Code:
include ("http://gah.stanford.edu/teams/HazteK_Software.html");
But when I try it, I get a blank page. I want it to display my stats for Genome@Home, but this is not working. I don't want to have to use something like inline frames because it's not very compatible with anything other than IE, and I want to keep away from them anyway. I also don't want to link to an external page because I want it to look like it's part of my site.
Thanks.
-
Oct 21st, 2002, 07:46 AM
#2
Fanatic Member
You cannot have http:// inside your include tag
-
Oct 21st, 2002, 11:43 AM
#3
Thread Starter
PowerPoster
Taken from here
PHP Code:
<?php
/* This example assumes that [url]www.example.com[/url] is configured to parse .php *
* files and not .txt files. Also, 'Works' here means that the variables *
* $foo and $bar are available within the included file. */
// Won't work; file.txt wasn't handled by [url]www.example.com[/url] as PHP
include 'http://www.example.com/file.txt?foo=1&bar=2';
// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';
// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';
$foo = 1;
$bar = 2;
include 'file.txt'; // Works.
include 'file.php'; // Works.
?>
Why do they have it on their site and in their manual if it doesn't work??
-
Oct 21st, 2002, 04:53 PM
#4
Stuck in the 80s
Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via this function, even if allow_url_fopen is enabled.
Is this you?
-
Oct 21st, 2002, 04:54 PM
#5
Stuck in the 80s
And what is "allow_url_fopen" set to in your php.ini?
-
Oct 21st, 2002, 08:26 PM
#6
Thread Starter
PowerPoster
allow_url_fopen is set to on, but I just read that about the 4.3 problem this morning... I'll update it now, then see if it works.
-
Oct 22nd, 2002, 06:26 PM
#7
Stuck in the 80s
Re: Including External files
Originally posted by MidgetsBro
PHP Code:
include ("http://gah.stanford.edu/teams/HazteK_Software.html");
Just a side note: you don't need to surround the included file in ()'s. Just seems like a waste to me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|