include full url to site?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Patriot
Forum Commoner
Posts: 34
Joined: Tue Jun 18, 2002 1:36 pm

include full url to site?

Post by Patriot »

how would you include the full url of the site in an include?

in my errors when the page can't be found it shows:
'S:\Inetpub\sites\smyr argetroot php\headlines.txt'
so i put it in the include:
<? include("S:\Inetpub\sites\smyr\targetroot\nphp\headlines.txt") ?>
but i get this:
Warning: Failed opening 'S:\Inetpub\sites\smyr argetroot php\headlines.txt' for inclusion (include_path='.;c:\php4\pear') in S:\Inetpub\sites\smyr\targetroot\right8.php on line 109

am i missing something?
or is it just a typing mistake?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Try to use forward slashes instead of backslashes - or escape them so:

Code: Select all

include 'S:/Inetpub/sites/smyr/targetroot/nphp/headlines.txt';
// OR
include 'S:\\Inetpub\\sites\\smyr\\targetroot\\nphp\\headlines.txt';
Mac
honkyinc
Forum Newbie
Posts: 19
Joined: Tue Jun 04, 2002 10:30 am
Location: Maryland, USA

Post by honkyinc »

I would assume that since the function takes relative URI paths, it would also take absolute paths in the same format.

Code: Select all

include("/includes/mydoc.inc");
Should work like:

Code: Select all

include("http://www.completesource.net/includes/mydoc.inc");
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post by will »

yeah, it works fine using absolute paths
Post Reply