View Full Version : php ?
dscikate
February 28th, 2002, 18:24
how do i use php to include a text file that's off my site?
wm2k1
February 28th, 2002, 19:05
i believe u could only include files that are local to the server
Dusty
February 28th, 2002, 19:17
You can include the text from a file from a remote server the same way you can from a local one, i.e. <?php include="http://remote/header.txt"; ?> would work just the same as <?php include "./header.txt"; ?>. If you were talking about including something you actually intend to be parsed along with the script, though, you can't do that.
wm2k1
February 28th, 2002, 19:41
nope...just test it myself to make sure, only could do it locally
it display when written for local, but can't display when the real internet address for the file was used
Dusty
February 28th, 2002, 19:48
Sure it works. If it doesn't on your server, make sure allow_url_fopen hasn't been disabled.
dscikate
February 28th, 2002, 19:50
i tried that first just changing the code to the url i was trying to link and it had a out put of a error message
dscikate
February 28th, 2002, 19:50
what i really want to do is link a image
the code for the image is in the text file
wm2k1
February 28th, 2002, 19:54
allow_url_fopen = On
not from the look of php.ini
dscikate
February 28th, 2002, 19:56
how can i do that?
Dusty
February 28th, 2002, 19:58
Are you trying to do something like this?
$img=fopen("http://server/image.gif","rb");
header("Content-type: image/gif");
fpassthru($img);
fflush();
Dusty
February 28th, 2002, 20:01
not from the look of php.iniI don't know what to tell you, Wm2k1. It works for me and it's described in the PHP manual.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.