Welcome to Dream.In.Code
Become a PHP Expert!

Join 136,912 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,733 people online right now. Registration is fast and FREE... Join Now!




using opendir()

 
Reply to this topicStart new topic

using opendir()

chriscross
9 Mar, 2008 - 07:35 AM
Post #1

New D.I.C Head
*

Joined: 8 Mar, 2008
Posts: 5

hey
I'm trying to open some files from a different server for a photo gallery.
how can i accomplish this?
(in more detail: I have the script below on 1 server, and i;m trying to use the opendir() to retrieve files from another server)

appreciate any help

CODE

$albumName = "$album_name"; // Name your album!

$dirr = 'http://www.siteurlhere.com/'.$album_folder.'/';

$p = $_GET['p'];
if ($handle = opendir("$dirr")) {
    $i = 1;
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            $img[$i] = $file;
            if ($p == $img[$i]) {
                $ci = $i;
            }
            $i++;
        }
    }

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Using Opendir()
9 Mar, 2008 - 10:55 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,998



Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do

User is online!Profile CardPM
+Quote Post

jlhaslip
RE: Using Opendir()
11 Mar, 2008 - 02:33 AM
Post #3

New D.I.C Head
*

Joined: 26 Aug, 2007
Posts: 3


My Contributions
Quite often a Hosting server will deny this request for security reasons. Do you have ftp access to the remote site?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:00PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month