Reputation: 11
I have an URL. When I am running that URL via browser, it is giving the expected response. But when it is called via file_get_contents, it is returning a different response.
There are a lot of parameters with the value in the Korean Language. I am not sure why it is happening. Any help will be appreciated.
Also, we have used curl
, but it was returning blank. So, curl didn't work too.
Upvotes: 1
Views: 189
Reputation: 622
You could try:
function file_get_contents_utf8($url) {
$content = file_get_contents($url);
return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content,'UTF-8, ISO-8859-1', true));
}
Upvotes: 1