Jump to content

[SOLVED] Remote Server Access


ainoy31

Recommended Posts

I need to check disk space on a remote server from my web application.  I have tried this piece of code:

 

$access = "ssh user@server-ip-address df -k";

$data = shell_exec($access);

 

If nothing prints out.  I know there is the disk_total_space("/") function but since this is on a remote server.  Much appreciation on any suggestions. AM

 

 

Link to comment
https://forums.phpfreaks.com/topic/155983-solved-remote-server-access/
Share on other sites

You can not do this directly, you need to go by a script on your remote server who retrieves that specific piece of information.

 

On your remote server you put this file:

<?php
print disk_total_space('/');
?>

 

On your server you then do:

<?php
$diskspace = file_get_contents('http://domain/path/to/file/php', 'r'); // assuming your server allows to read remote files
echo $diskspace;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.