sd9sd Posted June 23, 2008 Share Posted June 23, 2008 // Set up variables $host = "ftp.thesite.com"; // host (website) that contains the folder you want to change $user = $un; // username to log onto the host $password = $pas; // password to log onto the host $folder = "public_html/"; //directory in which the file has to be deleted // connect to FTP site $conn = @ftp_connect("$host");$trials++; if (!$conn) {echo("&result=0&");echo 'Error: Could not connect to ftp server';ftp_close($conn);exit;} // login to FTP site $result = @ftp_login($conn, $user, $password);$trials++; if (!$result) {echo("&result=0&");echo "Error: Could not log on as $user";ftp_quit($conn);exit;} I've tried using the above code, but am not able to even get the filenames from the root directory. PHP shows this error: Warning: opendir(ftp.thesite.com/public_html/images/) [function.opendir]: failed to open dir: No such file or directory in /home/somedomain/public_html/imageSlideshow.php on line 98 ERROR: Couldn't load the toon names. This is the code at lines 97 and 98: $pathForNameCollection="ftp.thesite.com/public_html/images/"; if ($handle = opendir($pathForNameCollection)) Could someone tell me where I've gone wrong please? Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/ Share on other sites More sharing options...
runnerjp Posted June 23, 2008 Share Posted June 23, 2008 No such file or directory in /home/somedomain/public_html/imageSlideshow.php <--- read it!!!! you have got the wrong directory Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572101 Share on other sites More sharing options...
sd9sd Posted June 23, 2008 Author Share Posted June 23, 2008 No such file or directory in /home/somedomain/public_html/imageSlideshow.php <--- read it!!!! you have got the wrong directory err...actually it's the right directory, but trying to open the file in the current domain (somedomain). I need it to open the php file which is in thesite.com domain. Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572102 Share on other sites More sharing options...
sd9sd Posted June 23, 2008 Author Share Posted June 23, 2008 No such file or directory in /home/somedomain/public_html/imageSlideshow.php Hey doesn't this line actually mean that while executing the imageSlideshow.php file, the filename specified in line 98 doesnt' exist? imageSlideshow.php is the main php file that's being executed. It is imageSlideshow.php that is showing this error. Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572104 Share on other sites More sharing options...
kenrbnsn Posted June 23, 2008 Share Posted June 23, 2008 Remove the "ftp.thesite.com/" from the path. Ken Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572110 Share on other sites More sharing options...
sd9sd Posted June 23, 2008 Author Share Posted June 23, 2008 But I'm trying to connect to www.thesite.com from www.somesite.com. My PHP files are on www.somesite.com, and the image files are on www.thesite.com. Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572112 Share on other sites More sharing options...
kenrbnsn Posted June 23, 2008 Share Posted June 23, 2008 You're using FTP to connect to the remote system, then you're trying to use a non-ftp function to get the files. You can't do that. Use FTP to get the files. Ken Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572116 Share on other sites More sharing options...
sd9sd Posted June 23, 2008 Author Share Posted June 23, 2008 oh...thanks for replying...but I need to do two kinds of tasks for my slideshow. 1. Get all the filenames from the images folder in www.thesite.com 2. Using these filenames, I need to show those images of www.thesite.com, on www.somesite.com. I thought opendir() was an ftp command (its mentioned that it is so from PHP 5 and I'm using PHP 4.4)...which other commands can I use? OR is there a better way of connecting to that site and getting data from it? Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572119 Share on other sites More sharing options...
kenrbnsn Posted June 23, 2008 Share Posted June 23, 2008 Use the FTP functions to get a list of files in the directory. A good one would be ftp_nlist. Once you have the list of files, you can then use a regular <img> tag to show the image. Ken Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572191 Share on other sites More sharing options...
sd9sd Posted June 24, 2008 Author Share Posted June 24, 2008 Thanks a lot kenrbnsn. It works Link to comment https://forums.phpfreaks.com/topic/111459-solved-connecting-to-another-website-or-domain-with-php-to-access-the-images-from-there/#findComment-572971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.