0

I'm trying to get contents of somes files via another server with PHP using file_get_contents() and file(). Everything's fine but it takes a lot of times to load the page. Otherwise, if I get contents of a local file, it takes like 0,2 secs. I've tried this method but it didn't work.

Is there a way to get the content of the file quicker and still using PHP? Or combine PHP with js?

Thank you!

  • I mean, if the external server is slow, the external server is slow. – ceejayoz Feb 26 '21 at 03:13
  • No matter it's `file_get_contents()` or using cURL, downloading a file from the Internet takes time. For better UX, you should use AJAX to display a loading effect instead. – Raptor Feb 26 '21 at 03:14
  • Server speed should be fine, because when I open the file directly in my browser, this is almost instant. –  Feb 26 '21 at 03:17
  • from local server commandline `ping otherserver` – AbraCadaver Feb 26 '21 at 03:19

0 Answers0