This project is read-only.

//Sample Usage
//FYI, Ensure the SOAP and OpenSSL extensions are enabled on your PHP server.


$MSTagAuthToken = "My Auth Token";

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

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

//Create a new category
$category = new Category();
$result = $msTag->CreateCategory($userCredential, $category);

//Update a category
$categoryUpdate = new Category();
$categoryUpdate->setUTCStartDate(new DateTime('2010-09-25'));
$result = $msTag->UpdateCategory($userCredential, 'TestCategory', $categoryUpdate);

//Pause a category
$result = $msTag->PauseCategory($userCredential, 'TestCategory2');

//Activate a category
$result = $msTag->ActivateCategory($userCredential, 'TestCategory2');

//Create a new URL tag
$tag = new URITag();
$result = $msTag->CreateTag($userCredential, 'TestCategory2', $tag);

//Create a new FreeText tag
$freeTextTag = new FreeTextTag();
$freeTextTag->setFreeText('Here comes a free text message');
$freeTextTag->setUTCStartDate(); //Defaults to now
$freeTextTag->setUTCEndDate(new DateTime('2011-08-18'));
$result = $msTag->CreateTag($userCredential, 'TestCategory2', $freeTextTag);

//Update a tag
$updateTag = new URITag();
$result = $msTag->UpdateTag($userCredential, 'TestCategory2','TestTag1', $updateTag);

//Pause a tag
$result = $msTag->PauseTag($userCredential, 'TestCategory2','TestTag1');

//Activate a tag
$result = $msTag->ActivateTag($userCredential, 'TestCategory2','TestTag1');

//Delete a tag
$result = $msTag->DeleteTag($userCredential, 'TestCategory2','TestFreeText1');

//Get a Tag ID
$id = $msTag->GetTagID($userCredential, 'TestCategory2','TestTag1');

//Display Microsoft Tag image in browser
$result = $msTag->GetBarcode($userCredential,'TestCategory2','TestTag1','jpeg',2);

// or alternately, display as a QR code in browser
//$result = $msTag->GetQRCode($userCredential,'TestCategory2','TestTag1','jpeg',2);

$length = strlen($result);
header('Last-Modified: '.date('r'));
header('Accept-Ranges: bytes');
header('Content-Length: '.$length);
header('Content-Type: image/jpeg');
} else {
echo $msTag->getLastException();

Last edited May 22, 2012 at 6:16 PM by tbbucs4755, version 9


xietian0517 Aug 13, 2012 at 5:07 AM 
I want to know how to add a payload to the tag.Anyone help?

dsoprea Feb 6, 2012 at 5:16 PM 
Note, above, that the following line uses incorrect credentials variable $oCredential. All previous lines have used $userCredential.

$result = $msTag->GetBarcode($oCredential,'TestCategory2','TestTag1','jpeg',2);

Eloelle Mar 1, 2011 at 4:01 PM 
Is there any way to record device id's or would that be a different project?