I want to read the content of a file with its full domain and the file path, something like this:
What I can not do in this example: I have tried curl, fopen, file_get_contents and will not use the cue but it can not be found for any purpose. Is there no reason why it is not working, which I am missing? Here are code snippets for every effort, maybe someone knows what is wrong with one of them? By coincidence, if I could do Fopen: curl: file_get_contents: Thanks in advance for all help. works fine for PHP 4 & gt; = URL with 4.3.0 and PHP 5: "If enabled, then a URL with this function can be used as a filename" Many shared hosters this option is disabled, or is using an earlier version of PHP and is loading external files using PHP. Get started and take a look at your host web site so that it can block external files. http://www.example.com/files/file.txt
.. / Files / file.txt
../files/file.txt then it works for every option.
$ file = "http: // www example.com/files/file.txt";
$ f = fopen ($ file, 'r'); $ Data = ''; While (! Feof ($ f)) $ data = Fread ($ f, $ size); Fclose ($ f);
function curl ($ url) {$ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ url); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); $ Data = curl_xac ($ ch); Curl_close ($ ch); $ Return data; } $ Data = curl ($ file);
$ data = file_get_contents ($ file);
No comments:
Post a Comment