Re: Reading a file from another server
| From: | CDitty | Date: | Sat, 26 Jul 2003 16:35:14 +0000 |
| Subject: | Re: Reading a file from another server | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157013@lists.php.net to get a copy of this message | ||
Have you tried downloading the file to your server and then read it from there? I do this at least 15 times a day with several different sites and I rarely have any problems.
CDitty
At 11:28 AM 7/26/2003, Thomas wrote:
I know the url is good, cause I can go on to this domain and look at all my files. I guess I should explain a little further... This server is a game server for Counter-Strike. I'm trying to read a file on there called "mapcycle.txt". This server is a secure server, so I would need to use a username and password to get on. I I've tried a bunch of different things, and now I find that it has a problem connecting to secure servers. DO you know of a different way to connect to a secure server anhd get information other than the way I have been trying? This is what I'm usuing right now: <?php$prefix = "ftp://"; $username = "myUsername"; $password = "**********"; $url = "server.username.gameserver.com/"; $filename = "test.txt";$result = readfile($prefix . $username . ":" . $password . "@" . $url .$filename);print ($result);?> // OUTPUT 0 if I use anythign other than the ftp:// for a prefix (like http. or https) I get an error. Cheers. "Chris Shiflett" <shiflett@php.net> wrote in message news:20030726000932.19913.qmail@web14303.mail.yahoo.com... --- Thomas <zaxisnet@hotmail.com> wrote:readfile("ftp://username:password@server.somedomain.com/test.txt"); It doesn't have any errors and comes up blank. If I put: $result = readfile("ftp://username:password@server.somedomain.com/test.txt"); print ($result); it ends up showing a '0' by iteself.The readfile() functions outputs the contents of the file and returns the size of the file in bytes. So, when you assigned $result to the return value, you demonstrated that readfile() output 0 bytes (which explains why you didn't see anything). I'm pretty sure your php.ini is set to allow this, otherwise you would receive an error. I'm doubting whether that URL actually contains any content. How have you tested to be sure it does? Chris ===== Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php