Jump to content

Why can't I include a full url? (noob problem...)


n4iko

Recommended Posts

It's just a simple question...

 

<?php

include ('beginning.txt');

?>

 

Why can't I include the whole url, eg. ... include ('http://www.mywebsite.com/random/beginning.txt') ... ? It just shows a blank page if I type in the whole url name. I would like to include the file beginning.txt into several pages that are under the folder random. And another question... does it matter if I use ' or ". Some php guides say I should use include ('beginning.txt') some say I should use include ("beginning.txt").

Link to comment
Share on other sites

The single/double quote thing is irrelevant for what you require. Either will work just as well as the other. If you're just looking for the contents of a file, file_get_contents like n4iko mentioned will work fine.

 

If you absolutely NEED the full path, there is an allow_url_include in your php.ini file that you can turn ON.

Link to comment
Share on other sites

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.