By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

can't include 'http...foo.php', but can include 'http...foo.txt'

P: n/a
This seems weird, but when I use the following code,

include 'http://www.foo.com/includes.php';

includedfunction();

I am told that it is a call to an undefined function, but
'includedfunction' is on the server.

the following includes work fine, and the run the called function with
no trouble:

include 'http://www.foo.com/includes.phtml';
include 'http://www.foo.com/includes.txt';

all three include.php,.phtml & .txt are on the server and are exactly
identical. I am running php version 4.1.1. Anyone have any ideas?
Jul 16 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
In article <76*************************@posting.google.com> ,
go**********@paul13.com (paul13) wrote:
This seems weird, but when I use the following code,

include 'http://www.foo.com/includes.php';

includedfunction();

I am told that it is a call to an undefined function, but
'includedfunction' is on the server.


The include statement is include()'ing the _output_ of
http://www.foo.com/includes.php, not the contents of the file.

To demonstrate thist point, load http://www.foo.com/includes.php in your
browser and look for your function definitions. Then load
http://www.foo.com/includes.txt. You'll see the difference.

hth

--
Bulworth : fu***@fung.arg | My email address is ROT13 encoded, decode to mail
--------------------------|--------------------------------------------------
<http://www.phplabs.com/> | PHP scripts and thousands of webmaster resources!
Jul 16 '05 #2

P: n/a
EMS
On 19 Aug 2003 01:04:29 -0700, go**********@paul13.com (paul13) wrote:
This seems weird, but when I use the following code,

include 'http://www.foo.com/includes.php';

includedfunction();

I am told that it is a call to an undefined function, but
'includedfunction' is on the server.

the following includes work fine, and the run the called function with
no trouble:

include 'http://www.foo.com/includes.phtml';
include 'http://www.foo.com/includes.txt';

When you include it using a URL as above, the file is served from the
webserver which parses the php script as it has a php extension. With
the other extensions, the php code isn't parsed. Try looking at the
URL with a browser and you'll see what I mean.

Your include path should be a physical path to the file e.g:
include ('/usr/local/htdocs/includes/includes.php');
That way you can use a .php extension and nobody will see your source
code.

EMS
Jul 16 '05 #3

P: n/a
>
Your include path should be a physical path to the file e.g:
include ('/usr/local/htdocs/includes/includes.php');
That way you can use a .php extension and nobody will see your source
code.

EMS


How do I use the physical location for a page on another machine?

'http://www.foo.com/usr/local/htdocs/includes/includes.php'

with whatever is the acurate physical location following the .com?

Paul
Jul 16 '05 #4

P: n/a
On 1 Sep 2003 15:26:30 -0700 in
<message-id:76*************************@posting.google.com>
go**********@paul13.com (paul13) wrote:
How do I use the physical location for a page on another machine?

'http://www.foo.com/usr/local/htdocs/includes/includes.php'

with whatever is the acurate physical location following the .com?

You can't do this.. as HTTP requests are limited by the DirectoryRoot
(or any defined directory permissions).

If you need to include a remote file, change the extension from .php to
something that isn't parsed by the PHP module / interpreter (.inc is the
most common I think).

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #5

P: n/a
go**********@paul13.com (paul13) wrote in message news:<76*************************@posting.google.c om>...

How do I use the physical location for a page on another machine?

'http://www.foo.com/usr/local/htdocs/includes/includes.php'

with whatever is the acurate physical location following the .com?

Paul


I sure hope that URL is 404.

When you include a valid external URL you're including what that URL
outputs (should be obvious)? So pull up
'http://www.foo.com/includes.php' in your browser. View the source.
That's what you're including.
surely this is covered here:
http://us3.php.net/manual/en/function.include.php ?
Jul 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.