Jump to content

Recommended Posts

I am currently having some problems creating absolute links. I am trying to create a link in my right navigation area for a rss feed. This navigation area features on pages in a number of different levels so I want to create a link like this:

 

require_once ($docroot).'rss/rss.inc'

 

where $docroot is the name of my domain. However when I do this I get this message:

 

Warning: main(http://www.mydomain.com/rss/rss.inc) [function.main]: failed to open stream: Connection refused in /home/sites/mydomainname.com/public_html/news/index.php on line 18

Fatal error: main() [function.require]: Failed opening required 'http://www.mydomain.com/rss/rss.inc' (include_path='.:/usr/share/pear') in /home/sites/mydomain.com/public_html/news/index.php on line 18

 

 

When I use relative links such as

require_once '../rss/rss.inc'

I don't get this problem at all. Does anyone know what could be causing this?

 

Thanks

Russ

Link to comment
https://forums.phpfreaks.com/topic/123748-problem-with-absolute-link/
Share on other sites

Hi,

I've tried all the suggestions for trying to get this working and am still getting the error message of:

 

Warning: main(http://www.mydomain.com/rss/rss.inc) [function.main]: failed to open stream: Connection refused in /home/sites/mydomain.com/public_html/news/index.php on line 60

Fatal error: main() [function.require]: Failed opening required 'http://www.mydomain.com/rss/rss.inc' (include_path='.:/usr/share/pear') in /home/sites/mydomain.com/public_html/news/index.php on line 60

 

I've tried using $docroot=$_SERVER['DOCUMENT_ROOT']; as well as $_SERVER['PHP_SELF'] and $_SERVER['HTTP_HOST'] and keep getting the same response. Is there some kind of restriction that could be stopping the script from being accessed properly.

 

Any help would be greatly appreciated!

 

Thanks

Russ

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.