All possible ways to read a file from a remote server
Thanks for any hint.
3 Solutions collect form web for “All possible ways to read a file from a remote server”
- fopen() + fread() - file_get_contents() - curl - executing shell commands `wget 'www.google.com' -O saved.htm`; $result = `cat saved.htm`;
// not for remote server var req = new XMLHttpRequest(); req.open('GET', 'http://www.google.com', false); req.send(null); if (req.readyState==4) alert(req.responseText);
You’ve got the major options for PHP figured out.
Using a script-tag proxy
- server-side help ( xhr to
server-side page to do curl/wget )
- the resource has to be on your
domain and you can XMLHttpRequest it without server-side help.