Find latest Drupal version number
For Drupal 7, fetch the XML at https://www.drupal.org/node/3060/release/feed?api_version[0]=103 to get the release history. The first item's title contains the latest version.

&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;rss version="2.0" xml:base="https://www.drupal.org/node/3060/release?
    api_version[103]=103" xmlns:dc="http://purl.org/dc/elements/1.1/"&gt;
  &lt;channel&gt;
    &lt;title&gt;Releases for Drupal core&lt;/title&gt;
    &lt;link&gt;https://www.drupal.org/node/3060/release?api_version[103]=103&lt;/link&gt;
    &lt;description&gt;&lt;/description&gt;
    &lt;language&gt;en&lt;/language&gt;
      &lt;item&gt;
    &lt;title&gt;drupal 7.32&lt;/title&gt;
    &lt;link&gt;https://www.drupal.org/drupal-7.32-release-notes&lt;/link&gt;
    &lt;description&gt;...


If you want information for all major versions (including 8 and 9), you may simply use https://www.drupal.org/node/3060/release/feed. You are then required to go through the items until yo find a release for the major version you are looking for.