TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Absolute URL location not working... (http://www.talkphp.com/general/3788-absolute-url-location-not-working.html)

buildakicker 12-18-2008 05:37 PM

Absolute URL location not working...
 
Hello all,

Is there a reason why this:

PHP Code:

include('http://www.domain.com/inc/functions.php'); 

doesn't work.

But this:

PHP Code:

include('inc/functions.php'); 

Does?

This isn't always the truth, but seems to be when calling certain php and .xml files.

Village Idiot 12-18-2008 05:38 PM

You can not include a file via http.

buildakicker 12-18-2008 05:58 PM

can you explain why not? If that is just how it is, that's fine to :)

buildakicker 12-18-2008 06:18 PM

Would there be a way to use include even if the file calling it is deep within another directory? I don't want to change the link to the file each time the directory is deeper.

IE... inc/functions.php on home page...

inside AboutUs directory... ..inc/functions.php on aboutus.php

etc...

Thanks!

buildakicker 12-18-2008 06:21 PM

AH! This explains it:

Quote:

If you use absolute url's for includes then you need to use the file system path, not the web path. As the include is carried out by the server not the browser.

include('/var/www/domains/example.com/htdocs/include/some_file.php');

buildakicker 12-18-2008 06:29 PM

Is there any security issues with using the absolute path? Is it safer? Less Safe?

Sorry for all the questions. Thanks for the clarifications!

Village Idiot 12-18-2008 06:37 PM

Quote:

Originally Posted by buildakicker (Post 20623)
Is there any security issues with using the absolute path? Is it safer? Less Safe?

Sorry for all the questions. Thanks for the clarifications!

I cant think of any security issues using absolute opposed to relative paths could create.


All times are GMT. The time now is 10:52 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0