Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 07-19-2008, 10:07 AM
  #1
thereal88
Soldier (Level 11)
 
thereal88's Avatar
 
Join Date: Apr 2006
Location: The Netherlands
Posts: 128
iTrader: (0)
thereal88 is an unknown quantity at this point
Question copy () does not copy () well

Hi, I'm trying to copy some files from one site to another with PHP, but I came across a problem. There are 4 files to be copied, so I use these lines:
PHP Code:
copy ("http://www.mysite.nl/functions.inc""functions.inc");
copy ("http://www.mysite.nl/moveDir.inc""moveDir.inc");
copy ("http://www.mysite.nl/installDB.inc""installDB.inc");
copy ("http://www.mysite.nl/connect_ct.inc.php""connect_ct.inc.php"); 
But somehow, functions.inc and connect_ct.inc.php are copied empty, so I get 2 empty files. The other 2 are fine. Does anyone know why and how to fix it?
thereal88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-19-2008, 11:34 PM
  #2
erisco
P(s|h)?i
 
erisco's Avatar
 
Join Date: Dec 2005
Location: Within the division of zero
Posts: 5,761
iTrader: (0)
erisco will become famous soon enougherisco will become famous soon enough
I could definitely see connect_ct.inc.php coming up empty because the .php extension will (presumably) cause the server to run it through the PHP parser. As to why functions.inc comes up blank as well, I am not sure.
__________________
Haven't updated my signature in forever!
Namespaces in PHP 5.3 | Taking up some C | Getting more Pythonic...
Confused on framework choice? Agavi.
erisco is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-21-2008, 11:41 AM
  #3
thereal88
Soldier (Level 11)
 
thereal88's Avatar
 
Join Date: Apr 2006
Location: The Netherlands
Posts: 128
iTrader: (0)
thereal88 is an unknown quantity at this point
Well, they are all PHP files, so it doesn't matter the server throws it through the PHP parser, i think? I've been using .inc.php files for like forever and it never caused any trouble.
Anyway, I think the reason for both files to be empty is the same. Which, I don't know.
thereal88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2008, 10:15 AM
  #4
ScareCrowe
Warrior (Level 8)
 
ScareCrowe's Avatar
 
Join Date: Nov 2006
Location: Bloomington Illinois
Posts: 72
iTrader: (0)
ScareCrowe is an unknown quantity at this point
Quote:
Originally Posted by thereal88 View Post
Well, they are all PHP files, so it doesn't matter the server throws it through the PHP parser, i think? I've been using .inc.php files for like forever and it never caused any trouble.
Anyway, I think the reason for both files to be empty is the same. Which, I don't know.
If you want to copy a PHP file with its PHP code intact, you need to use FTP. By using the URL to the file you are requesting the file via the server, which will parse the file no matter what.

Is the server the files you want to copy from configured to parse .inc files?

If the server does parse .inc files (don't think thats a default) then that would explain both files being empty: the server is parsing them and showing you the output, which happens to be nothing.

Open functions.inc and connect_ct.inc.php in your browser and view the source code. If you get blank page for both you pretty much have your answer!
ScareCrowe is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2008, 10:57 AM
  #5
Vege
Novice
 
Vege's Avatar
 
Join Date: Sep 2004
Location: Finland
Posts: 2,564
iTrader: (0)
Vege will become famous soon enough
And top of the previous poster, never ever name php files .inc, allways with php extension.
__________________

i hate you
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2008, 09:49 PM
  #6
thereal88
Soldier (Level 11)
 
thereal88's Avatar
 
Join Date: Apr 2006
Location: The Netherlands
Posts: 128
iTrader: (0)
thereal88 is an unknown quantity at this point
I've always used .inc files. They are included by .php files. But I tried to run a test.inc file and it says the file cannot be found...
So I guess I need to rename all the .inc files to .php files? But then I still don't understand why one .inc file is copied correctly and the other isn't...
thereal88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-26-2008, 06:02 AM
  #7
thereal88
Soldier (Level 11)
 
thereal88's Avatar
 
Join Date: Apr 2006
Location: The Netherlands
Posts: 128
iTrader: (0)
thereal88 is an unknown quantity at this point
Ok, that's not it. I renamed all the .inc files to .php files and they're still copied empty.
Does it matter what's in the files? Maybe I could post the contents here...

Quote:
Originally Posted by ScareCrowe View Post
If you want to copy a PHP file with its PHP code intact, you need to use FTP. By using the URL to the file you are requesting the file via the server, which will parse the file no matter what.

Is the server the files you want to copy from configured to parse .inc files?

If the server does parse .inc files (don't think thats a default) then that would explain both files being empty: the server is parsing them and showing you the output, which happens to be nothing.

Open functions.inc and connect_ct.inc.php in your browser and view the source code. If you get blank page for both you pretty much have your answer!
I opened the .inc files in my browser and it says 'file not found'...
The problem with FTP copying is that I don't know how many folders the copying file needs to go up and down...
But still, why does it copy 2 of the files correctly and not the other two?


Update: I tried FTP copying now, but that's actually something else so I posted a new Topic... I hope that's OK.

Last edited by thereal88 : 07-26-2008 at 09:27 AM.
thereal88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 10:36 PM
  #8
scoutt
Mister Admin to you
 
scoutt's Avatar
 
Join Date: Jul 2001
Posts: 30,255
iTrader: (0)
scoutt is a jewel in the roughscoutt is a jewel in the roughscoutt is a jewel in the rough
can copy really be used to copy form a URL? I am guessing not. If that was the case then we can copy scripts that we never paid for on sites we don't have access to. Doesn't seem to secure to me.
__________________
Have a Script or Snippet you want to share?

WWW Standards: HTML 4.01, CSS2.1, CSS3, XHTML 1.0
PHP Standards: PHP Standards
scoutt is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-29-2008, 04:23 AM
  #9
thereal88
Soldier (Level 11)
 
thereal88's Avatar
 
Join Date: Apr 2006
Location: The Netherlands
Posts: 128
iTrader: (0)
thereal88 is an unknown quantity at this point
Yeah, it's a bit strange, but two of them are actually getting copied correctly. That's strange too, then.
thereal88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 11:37 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.