简体   繁体   English

获取curl respone编码

[英]get curl respone encoding

I'm using cURL to retrieve a webpage. 我正在使用cURL来检索网页。
What's the easiest way to get encoding of the page? 获取页面编码的最简单方法是什么?

Of course I can parse response header to get charset, but I wonder if there is a better way. 当然,我可以解析响应头以获取字符集,但是我想知道是否有更好的方法。

在这种情况下,Imo最有效的方法是:

$sContentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM