开发者

PHP curl text vs binary data

开发者 https://www.devze.com 2023-01-20 10:51 出处:网络
How do I check multiple URLs with PHP. The data returned by from the urls might be in text (ASCII) fo开发者_StackOverflow社区rmat or in binary. How do i distinguish which one was returned.

How do I check multiple URLs with PHP. The data returned by from the urls might be in text (ASCII) fo开发者_StackOverflow社区rmat or in binary. How do i distinguish which one was returned.

My code has to just detect if the data is binary or text. Nothing else.

Thanks


Look at the content-type header

...
$response = curl_exec($ch);
$info = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
var_dump($info);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号