2011-03-28 11:59:46 0 Comments PHP Boy.Lee

file_get_contents grab html switch gb2312 to utf-8

{Code}

$url="http://yiilib.com";
$getContent = iconv("gb2312", "utf-8",file_get_contents($url));
echo $getContent;

get an online page's content through file_get_contents(), and use iconv to change encode type, for this example we change 'gb2312'(a kind chinese format) to 'utf-8'