4

I want to know the programmable logic of getting the magento version by just entering URL of the magento store.Something similar is seen here.

http://magentoversion.com/

2
  • 3
    What's the point of that service? Just log in into the backend and you'll see it there too. Commented May 19, 2015 at 8:40
  • This is for fingerprinting a Magento site that you don't have backend access to.
    – xyphoid
    Commented May 19, 2015 at 23:04

2 Answers 2

3

Finally after long research I found Following code useful to determine Version of Magento.

    <?php
function get_data($url) {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
} 
$file = $url.'/skin/frontend/default/default/css/styles.css';
$data = get_data($file);
$data   = explode("\n", $data);
for ($line = 0; $line < count($data); $line++)
 {
    if(strpos($data[$line],"2010" )){$mver= 1.5;}
    elseif(strpos($data[$line],"2011")){$mver= 1.6;}
    elseif(strpos($data[$line],"2012")){$mver= 1.7;}
    elseif(strpos($data[$line],"2013")){$mver= 1.8;}
    elseif(strpos($data[$line],"2014")){$mver= 1.9;}
}

?>

I hope it would help you all

2

https://github.com/steverobbins/magento-guest-audit/blob/master/src/MGA/Check/Version.php(broken) https://github.com/steverobbins/magescan/blob/master/src/MageScan/Check/Version.php

MGA fetches js/varien/product.js, and then pulls license information and the copyright year from the header to guess at the version. Note that it can't differentiate 1.4 from 1.5 this way - if you cared enough you could keep a list of hashes of each JS file and track changes in more detail.

1
  • Can you explain me this code in deep please I am not getting it. Commented May 11, 2015 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.