How to search for files in PHP in remote directory?

0

I have a project that is in the / var / www / html / enterprise folder and I need to access an audio file (.wav) in another folder, which is / var / spool / asterisk / monitor . I put the path as though it can not fetch.

Could anyone help me?

    
asked by anonymous 08.01.2018 / 15:02

1 answer

0

You could use glob , like this:

foreach (glob('/var/spool/asterisk/monitor/*.wav') as $arquivo) {
     echo 'Arquivo: ', $arquivo, '<br>';
}

Perhaps the varie extent could do so to stay case-insensitive:

foreach (glob('/var/spool/asterisk/monitor/*.[wW][aA][vV]') as $arquivo) {
     echo 'Arquivo: ', $arquivo, '<br>';
}

However it is important to note, perhaps% com_of% does not have read and execute permission for the script or for the Apache user, so you will not have access, to gain access to the folder you could apply permissions or else change the owner of the monitor folder, but I do not know if this folder is used by another application and if that would affect the execution.

If you are in a web host you probably will not get much, even if you have SSH, but it's up to you to consult technical support.

    
17.08.2018 / 22:07