Jump to content

Creating files on different domain


MrAdam
 Share

Recommended Posts

Hey all!Im trying to create a scirpt that will very simply create a file on a different subdomain.Im running the scirpt on: www.newbiestyle.co.ukAnd wanting to create the file at: www.store01.newbiestyle.co.ukSo far I have:

$file_name = "http://www.store01.newbiestyle.co.uk/flash/test.txt"; // Will vary!$handle = fopen($file_name, 'w') or die("Couldn't create file!");fclose($handle);

I ran Windows FTP, right clicked the folder "flash" > "properties" > Set the permissions to as 'little' as possibile, checking all the boxes.However when I run the scirpt I'm getting:Warning: fopen(http://www.store01.newbiestyle.co.uk/flash/-214748364813040602130201.swf): failed to open stream: HTTP wrapper does not support writeable connections. in /home/fhlinux218/n/newbiestyle.co.uk/user/htdocs/flash/submit.php on line 77Couldn't create file!Anybody have any ideas how I can get round this?-Thankyou!

Link to comment
Share on other sites

You can't use fopen to write a file over http. The http protocol doesn't support that. One thing you can do is to create the file locally first, save it and everything, and then open a ftp connection to the subdomain and transfer it across.Here are the FTP functions:http://us2.php.net/manual/en/ref.ftp.phpYou will use functions in this order:ftp_connect (connect to the server)ftp_login (login to the server)ftp_chdir (change to the subdomain folder)ftp_put (upload the file)ftp_close (close the connection)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...