PHP CURL - how to tell if the entire file requested was not fully downloaded
问题 I'm using CURL and a proxy to grab some xml files, occasionally only part of the XML document comes through and fails when I try to load/use the xml (simplexml_load_string). I thought something like.. if(curl_errno($ch)) { $error = curl_error($ch); // handle error } would catch this sorta error via CURL errno.. CURLE_PARTIAL_FILE (18) A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't