file_get_contents() Breaks Up UTF-8 Characters

I had similar problem with polish language I tried: $fileEndEnd = mb_convert_encoding($fileEndEnd, ‘UTF-8’, mb_detect_encoding($fileEndEnd, ‘UTF-8’, true)); I tried: $fileEndEnd = utf8_encode ( $fileEndEnd ); I tried: $fileEndEnd = iconv( “UTF-8”, “UTF-8”, $fileEndEnd ); And then – $fileEndEnd = mb_convert_encoding($fileEndEnd, ‘HTML-ENTITIES’, “UTF-8”); This last worked perfectly !!!!!!

PHP ini file_get_contents external url

Complementing Aillyn’s answer, you could use a function like the one below to mimic the behavior of file_get_contents: function get_content($URL){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $URL); $data = curl_exec($ch); curl_close($ch); return $data; } echo get_content(‘http://example.com’);

Get file content from URL?

Depending on your PHP configuration, this may be a easy as using: $jsonData = json_decode(file_get_contents(‘https://chart.googleapis.com/chart?cht=p3&chs=250×100&chd=t:60,40&chl=Hello|World&chof=json’)); However, if allow_url_fopen isn’t enabled on your system, you could read the data via CURL as follows: <?php $curlSession = curl_init(); curl_setopt($curlSession, CURLOPT_URL, ‘https://chart.googleapis.com/chart?cht=p3&chs=250×100&chd=t:60,40&chl=Hello|World&chof=json’); curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true); curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true); $jsonData = json_decode(curl_exec($curlSession)); curl_close($curlSession); ?> Incidentally, if you just want … Read more

tech