I am learning PHP, and I’m trying to make an application that has a relationship with an external website.
I need to download it.
So I got this code:
$str = file_get_contents($url);
Which should return me the HTML contents of a website.
it works fine for most websites, but for a particular one – http://www.fxp.co.il – it shows crap.
What is the problem ? What can I do to fix it ?
Thank you !

Well, you should actually inspect the response headers as they tell you about the encoding of the data returned
file_get_contents.For example, if it’s gzip encoded, you need to uncompress it.
Normally you won’t notice that because
file_get_contents()sends a request in a way that the server knows that it does not support compression.However some servers just do not care and send you compressed responses anyway:
Output:
Take care!