Re: Reading a file from another server
| From: | Thomas | Date: | Sat, 26 Jul 2003 16:28:47 +0000 |
| Subject: | Re: Reading a file from another server | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157012@lists.php.net to get a copy of this message | ||
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/