bigcommerce/bigcommerce-api-php — pull request #87 by sforsberg (2014-02-07 16:18:22+00:00)
Title: Fixes the 'Empty reply fromm server' error (API Error #52) when trying to consecutively update store resources

The error occurs when attempts are made to update various resources consecutively within the same script execution, because of how the put function from src/Bigcommerce/Api/Connection.php manages the file handler for the temporary file.

The changes involve only the way the file handler for the temporary CURL file is used and managed by doing the following:
* Managing only 1 open file handler within a single instance of the Connection class by checking for a valid file handler and reopening when needed
* If no valid file handler was found, opens a new temp file with tmpfile() and assigns to `$this->handle`
* Performs an additional check to see if the temp file contains any content from a previous use of the file, truncates the file to 0 bytes, closes and reopens the file, and rewinds the pointer to the beginning of the file

Then the put function proceeds as before by writing the body of the request to the file.