PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:How to include a text file? (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:How to include a text file?


#5819
latwelve (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
How to include a text file? 1 Year, 7 Months ago Karma: 0  
I have DirectPHP installed and I'm trying to call a local text file.

I've tried includes, file_get_contents and no joy just an error.

Please help - Am I trying to do it in a restricted way?

I tried:
<?php include "http://www.example.co.uk/text.txt"; ?>

and:
<?php $homepage = file_get_contents("http://www.example.co.uk/text.txt');echo $homepage;?>

both relative and absolute urls?
 
  The administrator has disabled public write access.

#5820
latwelve (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:How to include a text file? 1 Year, 7 Months ago Karma: 0  
this is the error:

Parse error: syntax error, unexpected T_STRING in /plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
 
  The administrator has disabled public write access.

#5821
latwelve (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:How to include a text file? 1 Year, 7 Months ago Karma: 0  
<?php echo "test123";?> works fine btw
 
  The administrator has disabled public write access.
#5822
kksou (Admin)
Admin
Posts: 1722
graph
User Online Now Click here to see the profile of this user
Re:How to include a text file? 1 Year, 7 Months ago Karma: 27  
latwelve wrote:

I tried:
<?php include "http://www.example.co.uk/text.txt"; ?>


Hi,

Please put the above into a standalone .php file somewhere on your server.

Then load this file.

Please let me know what error messages you see on the screen.

If you did not see any error messages, please remember to turn on error_display in your php.ini. (you can do a quick google to see how to turn on the error_display. Also, if you change the php.ini, you might need to restart your web server so that the setting is reloaded.)

I believe it's the setting of your php.ini that does not allow remote include: http://stackoverflow.com/questions/1158348/including-a-remote-file-in-php

But let's take a look at the error message and we can confirm this.

Regards,
/kksou
 
  The administrator has disabled public write access.
#5830
latwelve (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:How to include a text file? 1 Year, 6 Months ago Karma: 0  
Hi it still gives the same error - I cannot edit the php.ini - I'm on a shared server.. I can add to the htaccess though?


Parse error: syntax error, unexpected T_STRING in
xx/xx/xx/x/x/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
 
  The administrator has disabled public write access.
#5831
kksou (Admin)
Admin
Posts: 1722
graph
User Online Now Click here to see the profile of this user
Re:How to include a text file? 1 Year, 6 Months ago Karma: 27  
Hi,

You are still using DirectPHP. It won't help.

What I've asked you to do earlier is to copy your PHP statement and put it in a standalone .php file somewhere on your serve. Say, if you call it test1.php, and you place it in your root folder. Then do a http://yourserver.com/test1.php

Please let me know what you error message on the screen.

Regards,
/kksou
 
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2012. kksou.com. All Rights Reserved