microsoft tag download barcode to disk
<p>I am using microsoft tag php library by Scott Vanderbeck.</p>

<p>It has a function to output the barcode to browser as an image to browser, but I would like download and save to disk. My goal is to loop through all the tags and download each barcode as an image onto a disk. I am not sure how to accomplish this.</p>

<p>Here is my code
require_once('MSTag_v2.php');</p>

<pre><code>$MSTagAuthToken = "your token";

//Create an MSTag interface instance
$msTag = new MSTag();

//Create User Credentials
$userCredential = new UserCredential($MSTagAuthToken);


//Display Microsoft Tag image in browser
$result = $msTag-&gt;GetBarcode($userCredential,'MAIN','Cyclamen coum Pewter','jpeg',1);

if($result)
{
    ob_start();
        $length = strlen($result);
        header('Last-Modified: '.date('r'));
        header('Accept-Ranges: bytes');
        header('Content-Length: '.$length);
        header('Content-Type: image/jpeg');
        print($result);
    ob_end_flush();
    exit;
} 
else
{
    echo $msTag-&gt;getLastException();
}
</code></pre>
