Warning: open directory: not implemented

I am new to PHP and I am trying to create a script. When I load the script, I get the following error:

Warning: opendir (http://www.hetweerinboskamp.nl/voorpagina/movies) [function.opendir]: failed to open directory: not implemented

<?php $hal =''; $dir ='http://www.hetweerinboskamp.nl/voorpagina/movies'; if ($handle = opendir($dir)) { // Loop the folders while (false !== ($file = readdir($handle))) { if(strlen($file) > 4) { $rawd = parsename($file); $hal.= 'new Date('.substr($rawd,0,4).', '.substr($rawd,4,2).'-1, '.substr($rawd,6,2).'),'; //$hal.= $rawd.','; } closedir($handle); } 
+6
source share
4 answers

opendir() used to open a local directory and with PHP 5.0.0 in the ftp directory.

If your PHP code runs on www.hetweerinboskamp.nl, then /voorpagina/movies is actually a local directory, and you can do this:

 $dir ='<wwwroot>/voorpagina/movies'; if ($handle = opendir($dir)) { 

where wwwroot is the root of the file system, as seen from your php code.

If you are trying to download content from another website, try for example. file_get_contents() . Note that if the remote server lists the contents of the directory, the list is actually an HTML page generated on the fly by the server. You may need to analyze this page. The best approach is to check if the server offers some kind of API where it sends the content in a standardized form, for example. in JSON format.

+6
source

opendir works with directories in the file system, not with HTTP URIs.

Although some HTTP URIs return directory lists (the one you are using is not a 404 error), these lists, like HTML documents created by a web server, are not actual directories.

+3
source

Most remote servers do not send a list of directories, because such an opendir cannot understand what you are trying to do so that it does not work.

You will need to use something like ftp, here is an example: http://php.net/manual/en/ftp.examples-basic.php or cURL

0
source

My problem was that I had the wrong path (http: // ....). Now I am using the relative path (from the root of my web space) and everything is working fine.

0
source

Source: https://habr.com/ru/post/923176/


All Articles