scandir( ) url
Posted by: nateharper (---.cable.mindspring.com)
Date: December 19, 2006 06:15PM

I am trying to scan a directory on my site, at [127.0.0.1]. the code in the file is

<?php
$dir = 'http://127.0.0.1/scan/1';
$files1 = scandir($dir);
$files2 = scandir($dir, 1);

print_r($files1);
echo "<br><br>";
print_r($files2);
?>
the folder '1' has a few pictures in it and not much else. when i do $dir = '1', then it works. the php web site says that you need to enable fopen wrappers in phpini so i did.
;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

; Whether to allow the treatment of URLs (like http:// or []) as files.
allow_url_fopen = On

; Define the anonymous ftp password (your email address)
;from="john@doe.com"

and saved and restarted apache.

when i open the file with the first code it spits out a bunch of error messages:

Warning: scandir(http://127.0.0.1/scan/1) [function.scandir]: failed to open dir: not implemented in E:\wamp\www\scan\index.php on line 3

Warning: scandir() [function.scandir]: (errno 0): No error in E:\wamp\www\scan\index.php on line 3

Warning: scandir(http://127.0.0.1/scan/1) [function.scandir]: failed to open dir: not implemented in E:\wamp\www\scan\index.php on line 4

Warning: scandir() [function.scandir]: (errno 0): No error in E:\wamp\www\scan\index.php on line 4


can someone help me?
-thanks for you help.

Options: ReplyQuote
Re: scandir( ) url
Posted by: eliezer (---.suth.com)
Date: December 19, 2006 06:40PM

why are you putting 127.0.0.1/scan/1 as the folder?

if youre running wamp by its default settings then you have your web root directory at C:\wamp\www and you have the folder to scan at C:\wamp\www\scan\1... right?

try:

<?php
$dir = '/scan/1';
$files1 = scandir($dir);
$files2 = scandir($dir, 1);

print_r($files1);
echo "<br><br>";
print_r($files2);
?>

that should work any way you run the script, no matter if youre accessing through the local host or through a remote access point (remote PC)

peace

Options: ReplyQuote
Re: scandir( ) url
Posted by: nateharper (69.91.34.---)
Date: December 20, 2006 04:31AM

it is working like that, but im trying to use this to scan something anywhere on any webpage. so im trying to get it so that
$dir='http://127.0.0.1/scan/1'

thanks

Options: ReplyQuote


Sorry, only registered users may post in this forum.