php调用时,出现乱码,请问该代码怎么转换,我是小白一枚

如题
就是被调用的网页是gbk,而当前页面是utf-8

<?php
$data=array('foo'=>'bar');
$data=http_build_query($data);

$opts=array(
    'http'=>array(
   'method'=>'POST',
   'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
    "Content-Length: ".strlen($data)."\r\n",
'content'=>$data
),
);
$context=stream_context_create($opts);
$html=file_get_contents('http://www.baidu.com',false,$context);
echo$html;
?>

$data = mb_convert_encoding($data ,'utf-8' , $fileType);

string iconv ( string in_charset, string out_charset, string str )

试试这俩