PHP accessing files from another network

0

I know this question can be marked as duplicate, but I have not found any definitive answer.

After all, is it possible to access files from a computer on the same network, using PHP, without changing Apache settings?

I did several tests listed below, I did not succeed in any of them.

<?php
    function getRealIpAddr() {

        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip=$_SERVER['HTTP_CLIENT_IP'];
        } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip=$_SERVER['REMOTE_ADDR'];
        }
        return $ip;

    } 

    echo getRealIpAddr();

    $teste = file_get_contents("file://".getRealIpAddr()."/dados_merilin/Pesquisa.pdf");

    var_dump($teste);

    $teste = file_get_contents("file:\\".getRealIpAddr()."\dados_merilin\Pesquisa.pdf");

    var_dump($teste);

    $url = file_exists("//".getRealIpAddr()."/dados_merilin/Pesquisa.pdf");
    var_dump($url);

    $url = file_exists("\\".getRealIpAddr()."\dados_merilin\Pesquisa.pdf");
    var_dump($url);

    $isFolder = is_dir("\\".getRealIpAddr()."\dados_merilin");
    var_dump($isFolder);

    $isFolder = is_dir("//".getRealIpAddr()."/dados_merilin");
    var_dump($isFolder);

    $arquivo = fopen("\\".getRealIpAddr()."\dados_merilin\Pesquisa.txt", 'r');

    var_dump($arquivo);

    $arquivo = fopen("//".getRealIpAddr()."/dados_merilin/Pesquisa.txt", 'r');

    var_dump($arquivo);

?>

Since the folder data_merilin is shared, with full access and the file exists in this folder.

Return is ...

So, is it possible?

    
asked by anonymous 21.07.2017 / 14:52

0 answers