NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP and FTP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-21-2005, 03:58 AM THREAD STARTER               #1 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




PHP and FTP


I am trying to echo the logfiles on my server onto a page but I get the following error messages:
Code:
Connected as yarrt.com@ftp.yarrt.com
Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 17

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051013.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 17

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 18

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051014.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 18

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 19

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051015.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 19

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 20

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051016.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 20

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 21

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051017.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 21

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 22

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051018.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 22

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 23

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051019.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 23

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 24

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051020.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 24

Warning: fopen(): php_hostconnect: connect failed in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 25

Warning: fopen(ftp://yarrt.com/logfiles/W3SVC1164009808/ex051021.log): failed to open stream: Bad file descriptor in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 25

Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 27



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 28



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 29



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 30



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 31



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 32



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 33



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 34



Warning: fread(): supplied argument is not a valid stream resource in e:\domains\y\yarrt.com\user\htdocs\statstest\index.php on line 35
The code I am using is:
PHP Code:
<?php
                    
$ftp_server 
"ftp.yarrt.com";
$ftp_user "---------------";
$ftp_pass "---------------";

// set up a connection or die
$conn_id ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

// try to login
if (@ftp_login($conn_id$ftp_user$ftp_pass)) {
   echo 
"Connected as $ftp_user@$ftp_server\n";
} else {
   echo 
"Couldn't connect as $ftp_user\n";
}

$file1=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051013.log','r');
$file2=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051014.log','r');
$file3=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051015.log','r');
$file4=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051016.log','r');
$file5=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051017.log','r');
$file6=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051018.log','r');
$file7=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051019.log','r');
$file8=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051020.log','r');
$file9=fopen('ftp://yarrt.com/logfiles/W3SVC1164009808/ex051021.log','r');

echo 
fread($file1,filesize($file1)).'<br><br>';
echo 
fread($file2,filesize($file2)).'<br><br>';
echo 
fread($file3,filesize($file3)).'<br><br>';
echo 
fread($file4,filesize($file4)).'<br><br>';
echo 
fread($file5,filesize($file5)).'<br><br>';
echo 
fread($file6,filesize($file6)).'<br><br>';
echo 
fread($file7,filesize($file7)).'<br><br>';
echo 
fread($file8,filesize($file8)).'<br><br>';
echo 
fread($file9,filesize($file9));

// close the connection
ftp_close($conn_id); 
????: NamePros.com http://www.namepros.com/programming/133592-php-and-ftp.html
?>
Barrucadu is offline  
Old 10-21-2005, 05:19 AM   #2 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



yarrt.com isn't running an accessible FTP server as far as I can see. Try ftp.yarrt.com?
primacomputer is offline  
Old 10-21-2005, 05:23 AM THREAD STARTER               #3 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




nope, tried that, I looked in FTP surfer and the url is ftp://yarrt.com
Barrucadu is offline  
Old 10-21-2005, 11:48 AM   #4 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
tried that host using an ftp client and it did not work so they must not have an ftp at that address unless it is down.

Did try what primacomputer suggested as well which DID work.

Looking at your code why are you 1 minute using ftp.yarrt.com and in the rest using ftp://yarrt.com that is most likely where your problem is.
Peter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
•Host Unlimited Websites - Only $5/Month +cPANEL|WHM|FANTASTICO ~ Shared & Reseller ~ Hoobastank68 Web Hosting Offers 0 10-03-2005 09:08 PM
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet Web Hosting Offers 0 09-17-2005 07:40 AM
PHP Designer 2005 dgridley Free Resources 16 09-09-2005 07:50 PM
WEB HOSTING - $4.99/MONTH For 1GB HD & 25GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet Web Hosting Offers 0 09-02-2005 07:20 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 11:55 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger