/    Sign up×
Community /Pin to ProfileBookmark

Problem with fopen

Could someone help me with this problem: have a bot on shell on one server, which make log file (log.txt) and I want to open that file on a specific page on my site which is on other server. I’ve tried to use following code (fopen) in .php file:

<?php
$file = fopen(‘http://shell-sample.com/user/archiva/log.txt‘, ‘r’) or exit(“Unable to open file!”);

while(!feof($file))
{
echo fgets($file). “<br />”;
}
fclose($file);
?>

but I always get message:

Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/user/public_html/index.php on line 2

Warning: fopen([url]http://shell-sample.com/user/archiva/url.txt):[/url] failed to open stream: Success in /home/user/public_html/index.php on line 2
Unable to open file!

Don’t know what is the problem, is that right command and is it written right? or is there any other way (code) I could do same – open that file.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@sitehatcheryAug 01.2006 — I tried it and get the same result. I cannot reach http://shell-sample.com/user/archiva/log.txt if I put it in the address bar. Also, I cannot reach http://shell-sample.com.
Copy linkTweet thisAlerts:
@aries34authorAug 02.2006 — url "http://shell-sample.com/user/archiva/log.txt" you tried to follow is just a example, real url is http://shells.hostingmania.co.yu/~skanner/arhiva/log.txt :p
Copy linkTweet thisAlerts:
@NogDogAug 02.2006 — See if [url=http://www.php.net/file_get_contents]file_get_contents()[/url] works.
×

Success!

Help @aries34 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...