473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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

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
5 2744
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
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
>
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kupo | last post by:
Hi, I'm currently writing website using php. My problem is, when I do: include("../../library/file.php"); // this is from e.g /level1/level2/something.php it works. However, when I use: ...
9
by: * | last post by:
i am using include("http://".$_SERVER."/db.php"); to include a file. It isnt returning anything or connecting to the database (which is what it is supposed to be doing). any ideas? if i put in...
2
by: Brad Waddell | last post by:
Hi I have common top and bottom pages for each page in my web site. I refer to them like this: <!--webbot bot="Include" U-Include="top.htm" TAG="BODY" --> I recently added a PHP helpdesk...
3
by: brianwalker | last post by:
hello all. I have a text document that stores text for use in a flash movie. I'm also using PHP to displace the same text on another page. However the text document includes 2 tags for use by...
3
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include...
1
by: Robert T. | last post by:
I have a PHP script that displays my online status and shows a window if I am online, or doesn't show anything if I am offline. I'd like to include the content of this remote PHP file inside a...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
3
by: mejpark | last post by:
Good afternoon PHPers, This morning I downloaded "PHP Users" from sourceforge to implement a user registration system. I followed the instructions in INSTALL.txt, and successfully configured...
12
by: FFMG | last post by:
Hi, Please help me settle a geek argument :). I believe that php caches included code whenever possible. So given the 2 files bellow. // file.php -------------------------------------...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.