得到curl respone编码 [英] get curl respone encoding

查看:148
本文介绍了得到curl respone编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cURL检索网页。
获取页面编码最简单的方法是什么?


当然我可以解析响应头来获取字符集,但是我想知道是否有更好的方法。

I'm using cURL to retrieve a webpage.
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 the most efficient way in this case will be:

$sContentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);

这篇关于得到curl respone编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆