Reputation: 6168
So I guess I just googled the wrong keywords, but anyway, I couldn't find an answer.
I have a php script which basically echoes the return of
file($url);
as a string. (it does something with this first, but this is irrellevant)
Doing it on localhost with xampp works perfectly, but on my server it doesn't. I assumed setting in .htaccess the header to
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
should do the trick, but it still didn't work, so: does the function file() need something like the fopen() needs allow_url_fopen = On in php.ini ?
--------------EDIT----------------- I just added a
try{$f=file($url);}catch(Exception $e){
echo 'Exception: ', $e->getMessage(), "\n";}
with allow_url_fopen still Off, but now it works for some strange reason. What is going on?
Upvotes: 0
Views: 47
Reputation: 111869
Yes, it needs allow_url_fopen
to be on
as all other PHP functions when you manipulate on external urls
Upvotes: 1