因此,我必须下载一个文件进行验证,我必须检查下载的文件是XML还是ZIP。
我有以下代码:
$url = $return->DocXMLLink; //link to download the file
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
$response = curl_exec($ch);
//by here I may get the file extension and do something
预先感谢