/    Sign up×
Community /Pin to ProfileBookmark

readfile() problem with included file

Hi,

I’m having trouble with an include() function.

The files that I am having problems with are located on two seperate domains, each in a subfolder:
[i]http://www.domain1.com/Folder1/[/i]
[i]http://www.domain2.com/Folder2/[/i]

[b]Code for [i]http://www.domain1.com/Folder1/File1.php[/i] as follows[/b]:
<?php include (‘http://www.domain2.com/Folder2/File2.php‘); ?>

[b]Code for [i]http://www.domain2.com/Folder2/File2.php[/i] as follows[/b]:
<?php readfile (‘File3.txt’); ?>

File3.txt is located in [i]http://www.domain1.com/Folder1/[/i], but the readfile() function tries to read [i]http://www.domain2.com/Folder2/File3.txt[/i], which doesn´t exist.

How can read [i]http://www.domain1.com/Folder1/File3.txt[/i] without using the full path?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@magoauthorFeb 23.2005 — Correction made (see above):

Code for http://www.domain1.com/Folder1/File1.php as follows:

<?php include ('http://www.domain2.com/Folder2/index.php'); ?>

[b]replaced by[/b]

Code for http://www.domain1.com/Folder1/File1.php as follows:

<?php include ('http://www.domain2.com/Folder2/File2.php'); ?>
Copy linkTweet thisAlerts:
@magoauthorFeb 23.2005 — Is there really no one who knows how to solve this?!
Copy linkTweet thisAlerts:
@bokehFeb 24.2005 — If the file is on the same server you can use relative URLs in all other situations you will need to use absolute URLs. Try re-writing your question in a clear fashion with a bit more background info and you might get a few more answers.
×

Success!

Help @mago spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...