Jump to content

file_get_contents() alternative


php_b34st

Recommended Posts

There is cURL, if you've got that installed. Example from the manual comments:

 

<?php
function curl_get_file_contents($URL)
    {
        $c = curl_init();
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($c, CURLOPT_URL, $URL);
        $contents = curl_exec($c);
        curl_close($c);

        if ($contents) return $contents;
            else return FALSE;
    }
?>

well i don't know much about sockets, but I think with sockets, the file is sent to you through the socket and then when you use fopen you are using it locally, so that whole allow_url_fopen shouldn't apply.  I could be wrong; as I said, I don't know much about sockets.

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.