PDA

View Full Version : [HowTo] Use the version check for your products


Hellcat
09 Jun 2006, 12:06
Howdy folks!

Since I just tapped into a trap here, I thought I'll write up a few lines about this already:

Like we all know ;) you can supply a version check URL in the product manager of vB 3.6.
This URL should return something like this:<version productid="my_product_id">1.2.3</version>It's pretty selvexplanatory, but anyway: first comes the product ID, that *MUST* match with the product ID of your product that's checking via this URL.

Versions in the following notation will work as well (I tested it): 1.23

OK, so far so already told on the vb.com announcement.


Here comes what they didn't tell us (yet) ;)

The request for the version is done via a POST request!
So, putting up a simple text or XML file that holds the current version will not work in most cases since most webservers answer a POST an a static page with "Method not supported".

So, you need a litte PHP script like this:<?php echo '<version productid="my_product_id">1.2.3</version>'; ?>A tiny little one-liner that does the trick.

You can also specify additional arguments in the URL like http://domain.tld/version.php?param1=foo&param2=bar
and such.

You can then grab those parameters via the $_REQUEST global:<?php

if ( $_REQUEST["p"] == "cool_product" )
{
echo '<version productid="cool_product">1.12</version>';
}

if ( $_REQUEST["p"] == "another_product" )
{
echo '<version productid="another_product">4.2.3</version>';
}

?>


That's about it.

Remeber: POST, not GET, and you'll get the post ;)