public static function uploadFileBinary($url, $localFile, $headerType = 'XML', $method = 'PUT')
    {
        $method = strtoupper($method);
        $headerType = strtoupper($headerType);

        AsposeApp::getLogger()->info("Aspose Cloud SDK: uploadFileBinary called", array(
            'url' => $url,
            'localFile' => $localFile,
            'headerType' => $headerType,
            'method' => $method,
        ));

        $fp = fopen($localFile, 'r');
        $session = curl_init();
        curl_setopt($session, CURLOPT_VERBOSE, 1);
        curl_setopt($session, CURLOPT_USERPWD, 'user:password');
        curl_setopt($session, CURLOPT_URL, $url);
        if ($method == 'PUT') {
            curl_setopt($session, CURLOPT_PUT, 1);
        } else {
            curl_setopt($session, CURLOPT_UPLOAD, true);
            curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'POST');
        }
        curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($session, CURLOPT_HEADER, false);
        if ($headerType == 'XML') {
            curl_setopt($session, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml', 'x-aspose-client: PHPSDK/v1.0'));
        } else {
            curl_setopt($session, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'x-aspose-client: PHPSDK/v1.0'));
        }
        curl_setopt($session, CURLOPT_INFILE, $fp);
        curl_setopt($session, CURLOPT_INFILESIZE, filesize($localFile));
        $result = curl_exec($session);
        curl_close($session);
        fclose($fp);
        return $result;
    }