Working with subdomain directories

Good afternoon.
How to write files to a subdomain? For example, the script was launched from the site, and this script needs to write (delete, etc.) a file located on a subdomain.

$directory = "";
$dir = opendir($directory);

It doesn’t work that way. With the indication of the protocol too.

Answer 1, authority 100%

Domains (and their paths) are in DNS and HTTP. Files are in the file system. These are two different sets (well, or a graph, how to imagine).

How an HTTP address (including scheme, host, port, and path) is converted to an address (path) in the file system depends on the server’s configuration. Find it out for your hoster (it’s different for everyone) and understand what path you need to specify in opendir().

Let’s say I organized the file system on one of my servers like this: (this is just an example)

  • /srv/– for
  • /srv/– for
  • /srv/– for

But it could be anything, like, or generally whatever. Therefore, check with the technical support or system administrator of your hosting provider. Or, if you are hosting yourself (and don’t know where it’s configured), specify what software you use on the server and we’ll try to figure it out from the configuration files.

Answer 2

If you have a Windjws server, then there will be one http directory, and if *nix, there will also be http and a bunch of directories, but the site will be located in http, so you just need to write:

 $directory = "cat";
  $dir = opendir($directory);