Get support from Xavier Media
It is currently Sun Dec 08, 2013 12:24 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: php include code problem
PostPosted: Sat Aug 15, 2009 7:36 am 
Offline
Rookie (I'm probably spamming)
Rookie (I'm probably spamming)

Joined: Sat Aug 15, 2009 7:24 am
Posts: 6
Points: 0
my php include code is running very well by which i can impot contents of a .txt and print store in a same directory.
my code is
PHP Code:
<?PHP include "textfile.txt" ; ?>
this
-----------------------------------------------------------------

but i want to include a .txt file store in another directory like the address of the file is http://www.somesite.com/textfile.txt. is there some way by include or other than include function to include a file hosted on some server plz help.


Report this post
Top
 Profile Send private message E-mail  
Reply with quote  
 Post subject: Re: php include code problem
PostPosted: Sat Aug 15, 2009 12:20 pm 
Offline
XavierForum.com Admin
XavierForum.com Admin
Super VIP Member
Super VIP Member
User avatar

Joined: Tue Mar 15, 2005 4:37 pm
Posts: 1082
Location: Sweden
Points: 1500
You could try fopen:
Code:
$handle = fopen("http://www.sampleaddress.com/", "r");

But that requires that your server support that kind of things too.

/Bylla

_________________
Xavier Media®
Join me at LinkedIn | Get your latest blog post in your signature you too


Report this post
Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: php include code problem
PostPosted: Fri Aug 21, 2009 7:42 pm 
Offline
Rookie (I'm probably spamming)
Rookie (I'm probably spamming)

Joined: Sat Aug 15, 2009 7:24 am
Posts: 6
Points: 0
can anyone solve this
base name of file is index.php



PHP Code:
1. <?php
2.
3. $filename= basename(__FILE__);
4. $newname= readfile("newname.txt");
5. $oldname= readfile("oldname.txt");
6.
7. if($filename != $newname){
8.
9. rename("$oldname","$newname");
10. }
11. else{
12. header('Location: $newname');
13. }
14.
15.
16. ?>


Report this post
Top
 Profile Send private message E-mail  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Registered users: No registered users


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Portal » Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[
SEO MOD © 2007 StarTrekGuide ]