CURLINFO_CONTENT_TYPE

CURL: Get Returned Content Mime Type

 

例如 :以下代码可以查询出天地图的tile图像类型为jpg

"http://t0.tianditu.com/img_c/wmts/wmts?Service=WMTS&Request=GetTile&Version=1.0.0&Style=Default&Format=tiles&serviceMode=KVP&layer=img&TileMatrixSet=c&TileMatrix=1&TileRow=0&TileCol=0"

        // Store the mime-type, if any. (Note: CURL manages the buffer returned by
        // this call.)
        char* ctbuf = NULL;
        if ( curl_easy_getinfo(_curl, CURLINFO_CONTENT_TYPE, &ctbuf) == 0 && ctbuf )
        {
            sp._resultMimeType = ctbuf;
        }

跟踪发现 ctbuf 为  "image/jpeg"

 

可参考 http://www.satya-weblog.com/2010/07/php-curl-get-returned-content-mime-type.html。 内容相同

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-02-20
  • 2021-06-24
相关资源
相似解决方案