Noob question about writing files with copy()

This is a noob PHP writing to system question. Are there restrictions to php’s copy() function writing within a password protected directory?

I’m trying to write the generated html content from a template page. I’m getting:

“401 Unauthorized
The requested page requires authentication”

File permissions for the template file, destination (to be replaced file) and the generating file are all 755. The .htaccess password was alread entered when the siteadmin directory was accessed to run the generation scriptie.

Is there a simple answer?
Chris

And the answer is…

  1. It wasn’t copy,
  2. it was file_get_contents
  3. .htaccess would not grant the permission to (2)
  4. found (http://www.electrictoolbox.com/php-file-get-contents-sending-username-password/) from a bloke who shows how to add .htaccess user=pass to the $context param of f_g_c()! Easy, Simple
    As they say in gameboyland, woot!
    Chris