Df
<?php
 
error_reporting(E_ALL);
 
function download($file_source, $file_target) {
        $rh = fopen($file_source, 'rb');
        $wh = fopen($file_target, 'wb');
        if ($rh===false || $wh===false) {
                // error reading or opening file
                return true;
        }
        while (!feof($rh)) {
                if (fwrite($wh, fread($rh, 1024)) === FALSE) {
                        // 'Download error: Cannot write to file ('.$file_target.')';
                        return true;
                }
        }
        fclose($rh);
        fclose($wh);
        // No error
        return false;
}
 
function downloadanddisplay($file_source) {
        //$rh = fopen($file_source, 'rb');
        $rh = fopen($file_source, 'r');
        if ($rh===false) {
                echo 'error reading or opening file';
                return true;
        }
        while (!feof($rh)) {
                if ( ($data=fread($rh, 1024)) === FALSE) {
                        echo 'Download error\n';
                        return true;
                } else echo $data;
        }
        fclose($rh);
        // No error
        return false;
}
 
$url= 'http://www.bibsonomy.org/bib/user/utrust';
 
if( isset($_GET['pi'])) phpinfo();
if( isset($_GET['dd'])) downloadanddisplay($url);
if( isset($_GET['cu']) ) {
    // a simple GET request:
    //include('eac_curl.class.php');
    $http = new cURL();
    $result = $http->get($url);
    echo $result;
};
 
?>
O ile nie zaznaczono inaczej, treść tej strony objęta jest licencją Creative Commons Attribution-ShareAlike 3.0 License